#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<20;


int main(){
    LL n,p,q;cin >> n >> p >> q;
    vector<LL> c(n);
    LL sum=0;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        sum+=c[i];
    }
    vector<LL> ss(n,0);
    for (int i = 0; i < n; i++) {
        ss[i] = p*i+c[i];
    }
    sort(ALL(ss));
    vector<LL> cum(n+1,0);
    for (int i = 0; i < n; i++) {
        cum[i+1] = cum[i]+ss[i];
    }
    LL ans=-LINF;
    for (int i = 0; i <= n; i++) {
        ans=max(sum+p*q*i+p*i*(i-1)-cum[i],ans);
    }
    cout << ans << endl;
    return 0;
}

