#include using namespace std; typedef long long LL; typedef __int128 INT; /*cin高速化*/ struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init; ostream& operator<<(ostream &os,INT x){ LL y; y=x; assert(y==x); os << y; return os; } istream& operator>>(istream &is,INT& x){ LL y; is >> y; x = y; return is; } const INT INF = 1e24; int main() { INT N,A,B,W; /*input N,A,B,W*/ { cin >> N >> A >> B >> W; assert(1 <= N && N <= 300000); assert(0 <= A && A <= 1000000); assert(0 <= B && B <= 1000000); assert(0 <= W && W <= 1000000); } vector D(N); { for(auto& it : D){ cin >> it; assert(0 <= it && it <= 1000000); } } /*DP*/ vector dp(N+1,INF); dp[0] = W; for(int i = 0; i < N; i++){ for(int j = 0; j <= i; j++){ dp[i + 1] = min(dp[i + 1],dp[j] + D[i] - A * (i - j) + B * (i - j) * (i - j + 1) / 2); } } /*output*/ INT res = INF; for(int i = 0; i <= N; i++) res = min(res,dp[i] - A * (N -i) + B * (N - i) * (N - i + 1) / 2); cout << res << endl; return 0; }