#include <cstdio>
#include <algorithm>

using namespace std;

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

	int N, C, Q;

	scanf("%d", &N);

	scanf("%lld", &P);

	scanf("%d", &Q);

	long long zenbugaishoku = 0;

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

		zenbugaishoku += C;

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

	sort(A, A + N);

	long long Answer = zenbugaishoku;

	long long sum = zenbugaishoku;

	long long V = 2 * P;

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

		Answer = max(sum, Answer);
	}

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

	return 0;
}