// 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: 3.4337058735955304x):
#include <cstdio>

#include <iostream>

#include <cstring>

#include <string>

#include <cmath>

#include <algorithm>

#include <cstdlib>

#include <utility>

#include <map>

#include <stack>

#include <set>

#include <vector>

#include <queue>

#include <deque>

#include <sstream>

#define x first

#define y second

#define mp make_pair

#define pb push_back

#define LL long long

#define LB long double

#define Pair pair<int,int>

#define LOWBIT(x) x & (-x)

using namespace std;



const int MOD=1e9+7;

const double eps=1e-10;

const int INF=2e9;

const LL LINF=2e16;

const int magic=100;



inline int getint()

{

	char ch;

	while ((ch=getchar())<'0' || ch>'9') {}

	int res=ch-'0';

	while ((ch=getchar())>='0' && ch<='9') res=res*10+ch-'0';

	return res;

}



int n,e,T;

LL a[100048];

priority_queue<pair<LL,int> > q1,q2;

LL dp[100048];



int main ()

{

	int i;

	n=getint();e=getint();T=getint();

	for (i=1;i<=n;i++) a[i]=(LL)getint();

	dp[0]=0;

	a[0]=0;

	q2.push(mp(a[0]-dp[0],0));

	//dp[1]=a[1]+T;

	//q2.push(mp(a[1]-dp[1],1));

	int num1,num2;

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

	{

		

		bool f=true;

		while (!q2.empty() && f)

		{

			int num=q2.top().y;f=false;

			if (T-2*a[i]+2*a[num+1]<0)

			{

				q2.pop();f=true;

				q1.push(mp(a[num]+2*a[num+1]-dp[num],num));

			}

		}

		LL ans1=LINF,ans2=LINF;

		if (!q1.empty())

		{

			num1=q1.top().y;

			ans1=dp[num1]+3*a[i]-a[num1]-2*a[num1+1];

		}

		if (!q2.empty())

		{

			num2=q2.top().y;

			ans2=dp[num2]+a[i]-a[num2]+T;

		}

		dp[i]=min(ans1,ans2);

		q2.push(mp(a[i]-dp[i],i));

	}

	//for (i=1;i<=n;i++) cout<<dp[i]<<' ';

	//cout<<endl;

	cout<<dp[n]+(e-a[n])<<endl;

	return 0;

}