class in{struct myIterator{int it;const bool rev;explicit constexpr myIterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(myIterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const myIterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const myIterator& begin(){return i;}const myIterator& end(){return n;}};

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    i64 n, p, q;
    cin >> n >> p >> q;
    vector<i64> a(n);
    for(i64& x : a) cin >> x;
    vector<i64> c(n);
    for(i64 i : in(n))
      c[i] = (q - i) * p - a[i];
    sort(c.rbegin(), c.rend());
    i64 ma = 0LL, score = 0LL;
    for(i64 i : in(n)) { // i + 1?????????????????¨???
        score += c[i];
        score += 2 * p * i;
        ma = max(ma, score);
    }
    cout << accumulate(a.begin(), a.end(), 0LL) + ma << endl;
}