#include #define int long long using namespace std; inline int read() { register int x=0,f=0;register char c=getchar(); while(c<'0'||c>'9')f=(c=='-'),c=getchar(); while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c&15),c=getchar(); return f?-x:x; } const int MAXN=1e6; int n,a,b,w,d[MAXN],dp[MAXN]; double Y(int i){ return 1.0*(dp[i]+i*a+1.0*b*(i*i+i)/2); } double X(int i){ return 1.0*i; } double K(int j1,int j2){ return 1.0*(Y(j1)-Y(j2))/(X(j1)-X(j2)); } int q[MAXN],head,tail; signed main() { memset(dp,0x3f,sizeof dp); n=read();a=read();b=read();w=read(); for(int i=1;i<=n;i++)d[i]=read(); dp[0]=w; head=1;tail=1;q[1]=0; for(int i=1;i<=n;i++){ while(head=1.0*i)head++; int j=q[head]; dp[i]=dp[j]-(i-j-1)*a+d[i]+b*(i-j-1)*(i-j)/2; while(head=K(q[tail],q[tail-1]) )tail--; q[++tail]=i; } int ans=1e18; for(int i=n;i>=0;i--){ ans=min(ans,dp[i]-(n-i)*a+b*(n-i+1)*(n-i)/2); } cout<