#include <bits/stdc++.h>
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; }
};
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<pair<i64, int>> c(n);
  for (int i : in(n)) {
    cin >> c[i].first;
    c[i].second = i;
  }
  sort(c.begin(), c.end());
  i64 ma = 0LL, sum = 0LL, jisui = 0LL;
  for (int i : in(n)) {
    i64 score;
    int id;
    tie(score, id) = c[i];
    jisui += p * (q - id);
    jisui += 2 * p * i;
    sum += score;
    ma = max(ma, jisui - sum);
  }
  cout << sum + ma << endl;
}
