#include using namespace std; int d[300005],q[300005]; long long f[300005]; int hd=1,tl=0; bool ok(int x,int y,int z){ return (__int128)(f[y]-f[x])*(z-y)>=(__int128)(f[z]-f[y])*(y-x); } bool test(int x,int y,long long z){ return f[y]-f[x]<=(__int128)(y-x)*z; } void add(int x){ while(tl>=hd+1&&ok(q[tl-1],q[tl],x))--tl; q[++tl]=x; } int main(){ int n,a,b,w; scanf("%d%d%d%d",&n,&a,&b,&w); for(int i=1;i<=n;++i)scanf("%d",&d[i]); memset(f,63,sizeof(f)); f[0]=w; for(int i=1;i<=n+1;++i){ long long sz=1ll*i*a+1ll*i*(i-1)/2*b; f[i-1]+=sz; add(i-1); while(tl>=hd+1&&test(q[hd],q[hd+1],1ll*i*b))++hd; int j=q[hd];f[i]=f[j]-1ll*i*j*b; long long zs=d[i]-1ll*i*a+1ll*i*(i-1)/2*b; f[i]+=zs; } printf("%lld\n",f[n+1]); return 0; }