#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	long long P, C[500000];

	int N, Q;

	scanf("%d", &N);

	scanf("%lld", &P);

	scanf("%d", &Q);

	long long zenbugaishoku = 0;

	for (int i = 0; i < N; i++)
	{
		scanf("%lld", &C[i]);

		zenbugaishoku += C[i];

		C[i] = C[i] - (Q - i) * P;
	}

	long long *E = C + N;

	sort(C, E);

	long long Answer = zenbugaishoku;

	long long sum = zenbugaishoku;

	long long V = 2 * P;

	for (int i = 0; i < N; i++)
	{
		sum += V * i - C[i];

		Answer = max(sum, Answer);
	}

	printf("%lld\n", Answer);

	return 0;
}