#include using namespace std; int N, A, B, W; int D[1000000]; int64_t num, sol; int Wa, Wb, Wc; int X, X2; int rec(int Wa, int Wb, int Wc, int X, int X2, int num) { if (num != N) { return rec( min(min(Wb + D[num], Wc + D[num]), Wa + D[num]), Wa - A + B, Wb - A + X * B < Wc - A + X2 * B ? Wb - A + X * B : Wc - A + X2 * B, 2, Wb - A + X * B < Wc - A + X2 * B ? X + 1 : X2 + 1, num + 1); } return sol = min(min(Wa, Wb), Wc); } int main() { cin >> N >> A >> B >> W; for (int i = 0; i < N; i++) cin >> D[i]; rec(W, W, W, 1, 1, 0); cout << sol << endl; }