#include<cstdio>
#include<algorithm>
const int N=1e5+5;
typedef long long LL;
int n,E,T,p[N];
LL dp[N];
int q[N],h,t;
int main(){
	scanf("%d%d%d",&n,&E,&T);
	for(int i=1;i<=n;++i)scanf("%d",p+i),dp[i]=0x7fffffffffffffff;
	int pre=0,mpos=0;
	for(int i=1;i<=n;++i){
		const int TL=T-2*p[i];
		while(h<t&&TL<=-2*p[q[h]+1])++h;
		int j=q[h];
		dp[i]=dp[j]-p[j]+std::max(TL,-2*p[j+1])+3LL*p[i];
		while(pre<i&&TL<=-2*p[pre+1]){
			if(dp[mpos]-p[mpos]-2LL*p[mpos+1]>dp[pre]-p[pre]-2LL*p[pre+1])
			mpos=pre;
			++pre;
		}
		j=mpos;
		dp[i]=std::min(dp[i],dp[j]-p[j]+std::max(TL,-2*p[j+1])+3LL*p[i]);
		while(h<=t&&dp[q[t]]-p[q[t]]>=dp[i]-p[i])--t;
		q[++t]=i;
	}
	printf("%lld\n",dp[n]+E-p[n]);
	return 0;
}