#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;
const int MAXN = 101010;
int N , E , T;
int x[MAXN];
ll f[MAXN];
int head = 1 , tail = 0;
ll minn = 1000000000000ll;
int q[MAXN];
ll t[MAXN];
void push(int p , ll now){
	while(head <= tail && now <= t[tail])
		tail --;
	q[++ tail] = p;
	t[tail] = now;
}
int main(){
	ios::sync_with_stdio(0);
	cin >> N >> E >> T;
	for(int i = 1 ; i <= N ; ++ i)
		cin >> x[i];
	f[N + 1] = 0;
	x[N + 1] = E;
	for(int i = N ; i >= 1 ; -- i){
		while(head <= tail && 2 * (x[q[head]] - x[i]) >= T){
			minn = min(minn , f[q[head] + 1] + 2ll * x[q[head]] + x[q[head] + 1]);
			head ++;
		}
		push(i , f[i + 1] + x[i + 1]);
		f[i] = minn - 3ll * x[i];
		if(head <= tail) f[i] = min(f[i] , t[head] + T - x[i]);
	}
	cout << f[1] + x[1] << endl;
	return 0;
}