#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100000
#define INF 1000000000000000000LL
using namespace std;
typedef long long LL;
LL p[MAXN+5];
LL dp[MAXN+5];
int N;
LL M;
LL T;
void Init()
{
	memset(dp,-1,sizeof(dp));
}
LL GetVal(int i,int j)
{
	return dp[j-1]+T-2LL*(p[i]-p[j])+3LL*(p[i]-p[j])+p[j]-p[j-1];
}
int main()
{
//	freopen("computer.in","r",stdin);
//	freopen("computer.out","w",stdout);
	Init();
	dp[0]=0;
	scanf("%d %lld %lld",&N,&M,&T);
	for(int i=1;i<=N;i++)
		scanf("%lld",&p[i]);
	LL minval=INF;
	int pn=-1;
	dp[0]=0;
	for(int i=1;i<=N;i++)
	{
		int pos=lower_bound(p+1,p+1+N,p[i]-T/2)-p;
		if(2*(p[i]-p[pos])==T)
			pos++;
		if(2*(p[i]-p[pos-1])>=T)
			while(pn<pos-1)
			{
				pn++;
				if(pn!=0)	minval=min(dp[pn-1]-2LL*p[pn]-p[pn-1],minval);
				else		minval=min(-3LL*p[pn],minval);
			}
		dp[i]=GetVal(i,pos);
		dp[i]=min(dp[i],minval+3LL*p[i]);
	}
	printf("%lld\n",dp[N]+M-p[N]);
	return 0;
}