#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; int N; ll A, B, W, INF = LLONG_MAX; int main(){ cin >> N >> A >> B >> W; vll D(N), cur(1100, INF), nex(1100, INF); rep(i, N)scanf("%lld", &D[i]); cur[0] = W; rep(i, N){ fill(all(nex), INF); rep(j, 1100)if(cur[j] != INF){ if(j != 1100 - 1) smin(nex[j+1], cur[j] - A + B*(j+1)); smin(nex[0], cur[j] + D[i]); } swap(cur, nex); } cout << *min_element(all(cur)) << endl; }