#include<iostream>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<vector>
#include<complex>
#include<map>
#include<set>
using namespace std;
#define int long long
vector<int> SS;
signed main(){
	int N, P, Q;
	cin >> N >> P >> Q;
	vector<int> C(N);
	for (int i = 0; i < N; i++) {
		cin >> C[i];
		C[i] -= P*(Q - i);
	}
	int sum = 0;
	for (int i = 0; i < N; i++) {
		sum += P*(Q - i);
	}
	sort(C.begin(), C.end());

	int x = 0;
	int res = -((int)1 << 60);
	//cerr << sum << endl;
	for (int i = N; i >= 0; i--) {
		if (i < N)x += C[i];
		res = max(res, sum + (P * (i*(i - 1))) + x);
		//cerr << sum + ((i*(i - 1)) / 2) + x << endl;
	}
	cout << res << endl;
}
