#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long INF = 1e18;
int x[N];
long long f[N];
long long calc(int j) {
	return f[j] - x[j];
}
int main() {
	int n, E, T;
	scanf("%d%d%d", &n, &E, &T);
	for (int i = 1; i <= n; ++ i) scanf("%d", &x[i]);
	deque<int> q;
	x[0] = 0;
	q.push_back(0);
	long long MIN = INF;
	int r = 0;
	for (int i = 1; i <= n; ++ i) {
		while (2 * (x[i] - x[r + 1]) >= T) {
			MIN = min(MIN, - 2LL * x[r + 1] - x[r] + f[r]);
			++ r;
		}
		while (q.front() < r) q.pop_front();
		int t = q.front();
		f[i] = min(3LL * x[i] + MIN, x[i] + T + calc(t));
		while (!q.empty() && calc(q.back()) > calc(i)) q.pop_back();
		q.push_back(i);
	}
	long long ans = E - x[n] + f[n];
	printf("%lld\n", ans);
}

