#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
typedef long long ll;
const int N=100005;
int n,e,t,x[N],i,j,k;
ll f[N],w=1ll<<60;
multiset<ll> st;
int main()
{
	scanf("%d%d%d",&n,&e,&t);
	for(i=1;i<=n;++i)
		scanf("%d",x+i);
	for(i=1,k=0;i<=n;++i)
	{
		st.insert(f[i-1]-x[i-1]+t);
		while(k<i&&2*(x[i]-x[k+1])>=t)
		{
			w=min(w,f[k]-x[k]-2*x[k+1]);
			st.erase(st.find(f[k]-x[k]+t));
			++k;
		}
		f[i]=1ll<<60;
		if(w<(1ll<<60))
			f[i]=min(f[i],w+2*x[i]);
		if(!st.empty())
			f[i]=min(f[i],*(st.begin()));
		//for(j=i-1;j>=0;--j)
			//f[i]=min(f[i],f[j]-x[j]+max(t,2*(x[i]-x[j+1])));
		f[i]+=x[i];
	}
	printf("%lld",f[n]+e-x[n]);
	return 0;
}
