// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



long long f[100010],c[100010],d[100010];

int x[100010];

int n,e,t,T;



inline void add1(int x,long long o)

{

	while(x<=n)

	{

		c[x]=min(c[x],o);

		x+=x&-x;

	}

}



inline long long ask1(int x)

{

	long long nowans=0x3f3f3f3f3f3f3f3fll;

	while(x)

	{

		nowans=min(nowans,c[x]);

		x-=x&-x;

	}

	return nowans;

}



inline void add2(int x,long long o)

{

	while(x)

	{

		d[x]=min(d[x],o);

		x-=x&-x;

	}

}



inline long long ask2(int x)

{

	long long nowans=0x3f3f3f3f3f3f3f3fll;

	while(x<=n)

	{

		nowans=min(nowans,d[x]);

		x+=x&-x;

	}

	return nowans;

}



int main()

{

	scanf("%d%d%d",&n,&e,&t);

	T=t;

	if(t%2)T++;

	for(int i=1;i<=n;i++)

		scanf("%d",&x[i]);

	memset(f,0x3f,sizeof(f));

	memset(c,0x3f,sizeof(c));

	memset(d,0x3f,sizeof(d));

	f[0]=0;

	for(int i=1;i<=n;i++)

	{

		f[i]=min(f[i],f[i-1]+x[i]-x[i-1]+t);

		int now=upper_bound(x+1,x+1+i,x[i]-T/2)-x;

		if(x[i]-T/2>=x[1])

		{

			now--;

			long long nowans=ask1(now);

			f[i]=min(f[i],3ll*x[i]+nowans);

		}

		if(x[i]-T/2<x[1])now=0;

		now++;

		long long nowans=ask2(now);

		f[i]=min(f[i],x[i]+nowans);

		/*for(int j=i+1;j<=n;j++)

		{

			if((x[j]-x[i])*2>=t)f[j]=min(f[j],f[i-1]+3ll*(x[j]-x[i])+x[i]-x[i-1]);

			else f[j]=min(f[j],f[i-1]+t-2*(x[j]-x[i])+3ll*(x[j]-x[i])+x[i]-x[i-1]);

		}*/

		add1(i,-3ll*x[i]+f[i-1]+x[i]-x[i-1]);

		add2(i,0ll+t-x[i]+x[i]+f[i-1]-x[i-1]);

	}

	cout<<f[n]+e-x[n];

}

// Faster C++ solution for the same problem (measured speedup: 1.899692582809699x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <cstdlib>



#define cmax(_a, _b) (_a < (_b) ? _a = (_b), 1 : 0)

#define cmin(_a, _b) (_a > (_b) ? _a = (_b), 1 : 0)

#define dmax(_a, _b) ((_a) > (_b) ? (_a) : (_b))

#define dmin(_a, _b) ((_a) < (_b) ? (_a) : (_b))



#define maxn 100010

#define lowbit(_x) ((_x) & (-(_x)))

typedef long long ll;

typedef double db;



const ll inf = 0x7ffffffffff;

ll f[maxn];

int x[maxn], hash[maxn], hcnt;

ll tr1[maxn], tr2[maxn];

void modify1(int pos, ll val)

{

	for (; pos <= hcnt; pos += lowbit(pos)) cmin(tr1[pos], val);

}

void modify2(int pos, ll val)

{

	for (; pos; pos -= lowbit(pos)) cmin(tr2[pos], val);

}

ll query1(int pos)

{

	ll ret = inf;

	for (; pos; pos -= lowbit(pos)) cmin(ret, tr1[pos]);

	return ret;

}

ll query2(int pos)

{

	ll ret = inf;

	for (; pos <= hcnt; pos += lowbit(pos)) cmin(ret, tr2[pos]);

	return ret;

}

int main()

{

	int n, E, T; scanf("%d%d%d", &n, &E, &T);

	for (int i = 1; i <= n; ++i) scanf("%d", x + i);

	for (int i = 0; i <= n; ++i) hash[++hcnt] = 2 * x[i];



	memset(tr1, 63, sizeof (tr1));

	memset(tr2, 63, sizeof (tr2));

	f[0] = 0;

	modify1(2, -2 * x[1]);

	modify2(2, 0);

	for (int i = 1; i <= n; ++i)

	{

		f[i] = inf;



		int pos = std::upper_bound(hash + 1, hash + hcnt + 1, 2 * x[i] - T) - hash - 1;

//		printf("pos %d\n", pos);

		ll tmp = query1(pos) + 3ll * x[i];

		cmin(f[i], tmp);

//		printf("tmp %lld\n", tmp);



		pos = std::lower_bound(hash + 1, hash + hcnt + 1, 2 * x[i] - T) - hash;

//		printf("pos %d\n", pos);

		tmp = query2(pos) + T + x[i];

		cmin(f[i], tmp);

//		printf("tmp %lld\n", tmp);

		

		modify1(i + 2, f[i] - 2ll * x[i + 1] - x[i]);

		modify2(i + 2, f[i] - x[i]);

		

//		printf("f[%d] = %lld\n", i, f[i]);

	}

	printf("%lld\n", f[n] + E - x[n]);

	return 0;

}