#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
int n, e, T, q[N], h, t;
using ll = long long;
ll f[N], a[N], p[N], d[N];

int main () {
	scanf("%d%d%d", &n, &e, &T); p[0] = -0x3f3f3f3f3f3f3f3f;
	for (int i = h = 1, k = 0; i <= n; ++i) {
		scanf("%lld", &a[i]); f[i] = 0x3f3f3f3f3f3f3f3f;
		d[i] = f[i - 1] - a[i - 1];
		while (h <= t && d[i] < d[q[t]]) --t; q[++t] = i;
		while (2 * (a[i] - a[k]) > T) if (q[h] == k++) ++h;
		f[i] = min(f[i], T + a[i] + d[q[h]]);
		if (k > 1) f[i] = min(f[i], 3ll * a[i] - p[k - 1]);
		p[i] = max(p[i - 1], 2ll * a[i] + a[i - 1] - f[i - 1]);
	}
	printf("%lld\n", f[n] + e - a[n]);
	return 0;
}