#include using namespace std; const int MAX_N = 300001; long long N, A, B, W, D[MAX_N], E[MAX_N], zero[MAX_N], one[MAX_N]; int main() { int i, j, k, oneLen; long long t, oneMin; scanf("%lld %lld %lld %lld", &N, &A, &B, &W); D[0] = E[0] = 0; for (i = 1; i <= N; i++) { scanf("%lld", &D[i]); E[i] = E[i - 1] - A + i * B; } zero[0] = one[0] = W; zero[1] = zero[0] + D[1]; one[1] = one[0] + E[1]; oneLen = 1; for (i = 2; i <= N; i++) { zero[i] = std::min(zero[i - 1], one[i - 1]) + D[i]; oneMin = zero[i - 1] + E[1]; k = 1; for (j = 2; j <= oneLen + 1; j++) { t = zero[i - j] + E[j]; if (t <= oneMin) { oneMin = t; k = j; } } one[i] = oneMin; oneLen = k; } printf("%lld\n", std::min(zero[N], one[N])); return 0; }