#include<bits/stdc++.h>
#define N 500005
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,p,q,c[N],x[N],ans;
priority_queue<ll> X;

int main(){
  cin>>n>>p>>q;
  for(int i=0;i<n;i++)cin>>c[i];
  for(int i=0;i<n;i++)
    x[i]=p*q,q++,ans+=x[i];
  for(int i=0;i<n;i++)
    X.push(c[i]-x[i]-2*p*(n-i-1));
  ll cnt=0,sum,maxsum=0;
  while(!X.empty()){
    ll t=X.top(); X.pop();
    sum+=t+cnt*(2*p);
    maxsum=max(maxsum,sum);
    cnt++;
  }
  cout<<ans+maxsum<<endl;
  return 0;
}