#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1 << 19;
class BIT {
 public:
  int bit[MAX_N + 1], n;
  BIT() { memset(bit, 0, sizeof(bit)); }
  BIT(int n) { this->n = n, memset(bit, 0, sizeof(bit)); }
  int sum(int i) {
    int second = 0;
    while (i > 0) {
      second += bit[i];
      i -= i & -i;
    }
    return second;
  }
  void add(int i, int x) {
    while (i <= n) {
      bit[i] += x;
      i += i & -i;
    }
  }
};
long long n, p, Q;
pair<long long, pair<long long, long long> > C[MAX_N];
int main() {
  cin >> n >> p >> Q;
  BIT B(n);
  for (int i = 0; i < n; i++) {
    cin >> C[i].second.first;
    C[i].second.second = i + 1;
    C[i].first = -(n - i - 1) * p * 2 + C[i].second.first;
  }
  sort(C, C + n, greater<pair<long long, pair<long long, long long> > >());
  long long sum = n * (2 * Q * p + (n - 1) * p) / 2, ans = sum;
  for (int i = 0; i < n; i++) {
    long long idx = C[i].second.second, cost = C[i].second.first;
    int l = B.sum(idx), r = i - l;
    sum += -(Q + (idx - l * 2) - 1) * p + C[i].first + p * r * 2;
    B.add(idx, 1);
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
