#include <bits/stdc++.h>
using namespace std;
const int N = 101010;
int n,e,t;
long long s[N],dp[N];
struct g{
	long long v;
	int pos;
}q[N];
int l,r;
long long tmp;
int main(){
	scanf("%d",&n);
	scanf("%lld%d",&s[n+1],&t);
	for (int i=1;i<=n;i++)
		scanf("%lld",&s[i]);
	
	l=1;r=0;tmp=(1LL<<50);
	q[++r].pos=1;
	q[r].v=t;
	for (int i=1;i<=n;i++){
		while ((s[i]-s[q[l].pos])*2>t) 
		{	
			tmp=min(tmp,q[l].v-t-2*s[q[l].pos]);
			l++;
		}
		dp[i]=(1LL<<50);
		dp[i]=min(dp[i],q[l].v+s[i]);
		dp[i]=min(dp[i],tmp+3*s[i]);
		while ((l<=r)&&(dp[i]-s[i]+t<=q[r].v)) r--;
		q[++r].pos=i+1;
		q[r].v=dp[i]-s[i]+t;
	}
	printf("%lld\n",dp[n]+s[n+1]-s[n]);
}