/* -*- coding: utf-8 -*- * * 2150.cc: No.2150 Site Supporter - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; const long long LINF = 1LL << 62; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; ll dp0[MAX_N + 1], dp1[MAX_N + 1]; /* subroutines */ inline void setmin(ll &a, ll b) { if (a > b) a = b; } /* main */ int main() { int n, k, x; scanf("%d%d%d", &n, &k, &x); for (int i = 0; i < n; i++) scanf("%d", as + i); fill(dp0, dp0 + n + 1, LINF); fill(dp1, dp1 + n + 1, LINF); dp0[0] = 0; for (int i = 0; i < n; i++) { if (dp0[i] < LINF) { setmin(dp0[i + 1], dp0[i] + as[i]); setmin(dp1[i + 1], dp0[i] + x + k); } if (dp1[i] < LINF) { setmin(dp0[i + 1], dp1[i] + as[i]); setmin(dp1[i + 1], dp1[i] + k); } } printf("%lld\n", min(dp0[n], dp1[n])); return 0; }