#include<bits/stdc++.h>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define INF 1e+18


signed main(){

  long long n,p,q,h,C=0,ret=-INF;
  cin >> n >> p >> q;
  vector<long long> c(n),ct(n),sum(n+1);
  rep(i,n){
    cin>>c[i];
    C += c[i];
    ct[i] = p*i+c[i];
  }
  sort(ct.begin(),ct.end());
  sum[0] = 0;
  rep(i,n)sum[i+1]=sum[i]+ct[i];
  rep(i,n+1){
    h = C+p*(i*i+(q-1)*i)-sum[i];
    if (h>ret) ret = h;
  }
  cout << ret << endl;

  return 0;
}

