#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))

int main(){
	long long n,p,q;
	cin>>n>>p>>q;
	vector<int> v(n);
	long long sum = 0;
	rep(i,n) cin>>v[i],sum+=v[i];
	vector<long long> w(n);
	rep(i,n){
		w[i]=v[i]-p*(q-i);
	}
	sort(w.begin(),w.end());
	long long ans = LLONG_MAX/2;
	ans*=-1;
	rep(i,n+1){
		// cout<<i<<" "<<sum<<" "<<i*(i-1)<<" "<<sum+i*(i-1)<<endl;
		ans=max(ans,sum+p*i*(i-1));
		if(i<n) sum-=w[i];
	}
	cout<<ans<<endl;
}