using static System.Math; using System.Collections.Generic; using System.Linq; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var k = int.Parse(line[1]); var x = int.Parse(line[2]); line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); getAns(n, k, x, a); } static void getAns(int n, int k, int x, int[] a) { var dp = new long[n, 2]; for (int i = 0; i < n; i++) for (int j = 0; j < 2; j++) dp[i, j] = long.MaxValue; dp[0, 0] = a[0]; dp[0, 1] = k + x; for (int i = 0; i < n - 1; i++) { var w = Min(dp[i, 0] + a[i + 1], dp[i, 1] + a[i + 1]); dp[i + 1, 0] = Min(dp[i + 1, 0], w); var w2 = Min(dp[i, 0] + k + x, dp[i, 1] + k); dp[i + 1, 1] = Min(dp[i + 1, 1], w2); } Console.WriteLine(Min(dp[n - 1, 0], dp[n - 1, 1])); } }