#include typedef long long LL; const int N = 3e5 + 7; int q[N], fr, ba; int n, a, b, d[N]; LL f[N]; LL X(int x) { return 1LL * b * x; } LL Y(int x) { return f[x] + 1LL * a * x + 1LL * x * (x + 1) / 2 * b; } int main() { scanf("%d%d%d%lld", &n, &a, &b, &f[0]); for(int i = 1; i <= n; ++i) scanf("%d", &d[i]); if(b == 0) { printf("%lld\n", f[0] - 1LL * a * n); return 0; } fr = ba = 1; for(int i = 1; i <= n + 1; ++i) { while(fr < ba && (Y(q[fr + 1]) - Y(q[fr])) <= i * (X(q[fr + 1]) - X(q[fr]))) ++fr; f[i] = f[q[fr]] + d[i] + 1LL * b * (i - q[fr]) * (i - q[fr] - 1) / 2 + 1LL * a * (q[fr] - i + 1); while(fr < ba && (Y(i) - Y(q[ba])) * (X(q[ba]) - X(q[ba - 1])) <= (X(i) - X(q[ba])) * (Y(q[ba]) - Y(q[ba - 1]))) --ba; q[++ba] = i; } printf("%lld\n", f[n + 1]); return 0; }