#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  lint p, q; cin >> p >> q;
  V<lint> c(n); for (auto&& e : c) cin >> e;
  lint curr = accumulate(begin(c), end(c), 0LL), res = curr;
  V<> idx(n);
  iota(begin(idx), end(idx), 0);
  sort(begin(idx), end(idx), [&](int i, int j) { return p * i + c[i] < p * j + c[j]; });
  int t = 0;
  for (int i : idx) {
    curr += p * (q - i + t) - c[i];
    t += 2;
    res = max(res, curr);
  }
  cout << res << '\n';
}
