#include <bits/stdc++.h> using namespace std; int main() { int N, A, B, W; cin >> N >> A >> B >> W; vector<int> D(N); for (int i = 0; i < N; ++i) { cin >> D[i]; } if (B == 0) { int64_t ans = W - (int64_t) N * A; cout << ans << endl; } else { int maxd = *max_element(D.begin(), D.end()); int threshold = ceil(sqrt(2 * (maxd + A) / B)); const int64_t INF = 3e11; vector<vector<int64_t>> dp(N + 1, vector<int64_t>(threshold, 3e11)); dp[0][0] = W; for (int i = 0; i < N; ++i) { for (int j = 0; j < threshold; ++j) { dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + D[i]); if (j + 1 < threshold) dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] - A + (int64_t) B * (j + 1)); } } int64_t ans = *min_element(dp[N].begin(), dp[N].end()); cout << ans << endl; } return 0; }