#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) template<typename V> struct ConvexHull { deque<pair<V, V>> Q; int cmptype = 0; // 0-min 1-max V calc(pair<V, V> p, V x) { return p.first*x + p.second; } int dodo(pair<V, V> A, pair<V, V> B, pair<V, V> C) { // max or min return cmptype ^ ((B.second - C.second)*(B.first - A.first) <= (A.second - B.second)*(C.first - B.first)); } void add(V a, V b) { // add ax+b Q.push_front({ a,b }); while (Q.size() >= 3 && !dodo(Q[0], Q[1], Q[2])) Q[1] = Q[0], Q.pop_front(); } V get(V x) { int L = -1, R = Q.size() - 1; while (R - L>1) { int M = (L + R) / 2; ((cmptype ^ ((calc(Q[M], x) >= calc(Q[M + 1], x)))) ? L : R) = M; } return calc(Q[R], x); } }; //----------------------------------------------------------------------------------- typedef long long ll; #define INF 1LL<<60 int N, A, B, W; int D[301010]; //----------------------------------------------------------------------------------- ll dp[301010]; int main() { cin >> N >> A >> B >> W; rep(i, 0, N) scanf("%d", &D[i]); dp[0] = W; rep(i, 1, N + 1) { dp[i] = INF; rep(j, 0, i) { ll w = dp[j]; int n = i - j - 1; w -= 1LL * A * n; w += 1LL * n * (n + 1) / 2 * B; w += D[i - 1]; dp[i] = min(dp[i], w); } } ll ans = INF; rep(i, 0, N + 1) { ll w = dp[i]; int n = N - i; w -= 1LL * A * n; w += 1LL * n * (n + 1) / 2 * B; ans = min(ans, w); } cout << ans << endl; }