#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
int main(){
	ll N,P,Q;
	cin>>N>>P>>Q;
	ll s=0;
	vector<ll> vc;
	rep(i,N){
		ll c;
		cin>>c;
		vc.pb(c-2*P*(N-1-i)-P*(Q+i));
		s+=P*(Q+i);
	}
	sort(all(vc),greater<ll>());
	ll ans=s;
	rep(i,N){
		s+=vc[i];
		s+=i*2*P;
		chmax(ans,s);
	}
	cout<<ans<<endl;
}