#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <set>
#define N 100010
#define LL long long
using namespace std;
int n, e, t;
int x[N];
LL dp[N];
multiset<LL> st1;
multiset<LL> st2;

int main() {
	scanf("%d%d%d", &n, &e, &t);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &x[i]);
	}
	
	dp[0] = 0;
	x[0] = 0;
	int last = 0;
	st1.insert(- 2LL * x[1]);
	st2.insert(t);
	for (int i = 1; i <= n; ++i) {
		while (last + 1 <= i && 2LL * (x[i] - x[last + 1]) >= t) {
			st1.insert(dp[last] - x[last] - 2LL * x[last + 1]);
			st2.erase(st2.find(dp[last] - x[last] + t));
			++last;
		}
		if (last - 1 >= 0) dp[i] = min(*st1.begin() + 3LL * x[i], *st2.begin() + x[i]);
		else dp[i] = *st2.begin() + x[i];
		st2.insert(dp[i] - x[i] + t);
//cout << dp[i] << ' ';
	}
//cout << endl;
	
	cout << dp[n] + e - x[n];
	return 0;
}