#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
#define LL long long
using namespace std;
multiset<LL> s1, s2;
LL dp[110000], dp2[110000];
int x[110000], n, E, T;
int main(){
	scanf("%d%d%d", &n, &E, &T);
	dp2[0] = T;s1.insert(T);
	for(int i = 1, j = 0; i <= n; i++){
		scanf("%d", &x[i]);
		while(j < i && 2 * (x[i] - x[j + 1]) >= T){
			s1.erase(s1.find(dp2[j]));
			dp2[j] = dp2[j] - T - 2 * (x[j + 1]);
			s2.insert(dp2[j]);
			j++;
		}
		dp2[i] = (((LL)1)<<50);
		if(!s1.empty()) dp[i] = max(dp[i], *s1.begin() + x[i]);
		if(!s2.empty()) dp[i] = min(dp[i], *s2.begin() + (LL)3 * x[i]);
		dp2[i] = dp[i] - x[i] + T; 
		s1.insert(dp2[i]);
	}
	cout<<dp[n] - x[n] + E;
	return 0;
}