#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


const int MAX_N = 312345;
ll D[MAX_N];
ll dp[MAX_N];

struct Line {
  ll a, b;
  ll f(ll x) { return a*x + b; }
};

bool check(Line l1, Line l2, Line l3) {
  return (l3.b-l2.b)*(l1.a-l2.a) <= (l2.b-l1.b)*(l2.a-l3.a);
}

int main2() {
  int N;
  ll A, B, W; cin >> N >> A >> B >> W;
  REP(i, N) { cin >> D[i]; }
  A *= 2; B *= 2; W *= 2;
  REP(i, N) D[i] *= 2;

  dp[0] = W;
  deque<Line> deq;
  REP(i, N) {
    Line line = (Line) {-i*B, dp[i] + i*A + B/2*i*i + i*B/2};
    while (deq.size() >= 2 && check(deq[deq.size()-2], deq[deq.size()-1], line))
      deq.pop_back();
    deq.push_back(line);
    while (deq.size() >= 2 && deq[0].f(i+1) >= deq[1].f(i+1)) deq.pop_front();
    ll val = deq[0].f(i+1);
    dp[i+1] = val + (D[i] - (i+1)*A + A + B/2*(i+1)*(i+1) - (i+1)*B/2);
  }

  ll ans = dp[N];
  for (int i = 0; i < N; i++) {
    chmin(ans, dp[i] - (N-i)*A + (ll)(N-i)*(N-i+1)/2*B);
  }
  cout << ans/2 << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}