#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p, q;
  long long h, C = 0, ret = -25 * 1e10;
  cin >> n >> p >> q;
  vector<int> c(n);
  vector<double> ct(n), sum(n + 1);
  for (int i = 0; i < (int)n; i++) {
    cin >> c[i];
    C += c[i];
    ct[i] = i + (double)c[i] / p;
  }
  sort(ct.begin(), ct.end());
  sum[0] = 0;
  for (int i = 0; i < (int)n; i++) sum[i + 1] = sum[i] + ct[i];
  for (int i = 0; i < (int)n + 1; i++) {
    h = C + p * (i * i + (q - 1) * i - sum[i]);
    if (h > ret) ret = h;
  }
  cout << ret << endl;
  return 0;
}
