#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N, P, Q;
    cin >> N >> P >> Q;
    vector<long> C(N);
    for(auto& i : C)cin >> i;
    
    vector<long> D(N);
    for(size_t i = 0; i < N; ++i)D[i] = (Q - i) * P - C[i];
    sort(D.rbegin(), D.rend());
    
    long ans{accumulate(C.begin(), C.end(), 0L)}, ad{ans};
    for(unsigned long k = 0; k < N; ++k)ans = max(ad += 2 * k * P + D[k], ans);
    
    cout << ans << endl;
}
