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

ll N,P,Q;
ll C[500005];
ll D[500005];
ll ans,sum,x;

int main(){
  cin>>N>>P>>Q;
  for(int i=0;i<N;i++){
    scanf("%lld",&C[i]);
    D[i]=C[i]-(Q-i)*P;
    sum+=C[i];
  }
  sort(D,D+N);
  ans=sum;
  for(int i=0;i<N;i++){
    sum-=D[i];
    x+=2*i*P;
    ans=max(ans,sum+x);
  }
  cout<<ans<<endl;
  return 0;
}