// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstdlib>

using namespace std;



#define lowbit(a) (a&-a)

typedef long long ll;

const int maxn = 100010; const ll inf = 1LL<<60;

int N,T,E,X[maxn]; ll tree1[4*maxn],tree2[4*maxn],f[maxn];



inline int gi()

{

	char ch; int ret = 0,f = 1;

	do ch = getchar(); while (!(ch >= '0'&&ch <= '9')&&ch != '-');

	if (ch == '-') f = -1,ch = getchar();

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

	return ret*f;

}



inline void build(int now,int l,int r)

{

	tree1[now] = tree2[now] = inf;

	if (l == r) return; int mid = (l+r) >> 1;

	build(now<<1,l,mid); build(now<<1|1,mid+1,r);

}



inline void modify(ll *tree,int now,int l,int r,int pos,ll key)

{

	if (l == r) { tree[now] = key; return; } int mid = (l+r)>>1;

	if (pos <= mid) modify(tree,now<<1,l,mid,pos,key);

	else modify(tree,now<<1|1,mid+1,r,pos,key);

	tree[now] = min(tree[now<<1],tree[now<<1|1]);

}



inline ll query(ll *tree,int now,int l,int r,int ql,int qr)

{

	if (ql == l&&qr == r) return tree[now]; int mid = (l+r)>>1;

	if (qr <= mid) return query(tree,now<<1,l,mid,ql,qr);

	else if (ql > mid) return query(tree,now<<1|1,mid+1,r,ql,qr);

	else return min(query(tree,now<<1,l,mid,ql,mid),query(tree,now<<1|1,mid+1,r,mid+1,qr));

}



int main()

{

	//freopen("G.in","r",stdin);

	//freopen("G.out","w",stdout);

	N = gi(); E = gi(); T = gi();

	for (int i = 1;i <= N;++i) X[i] = gi(),tree1[i] = tree2[i] = 1LL<<60;

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

	{

		modify(tree1,1,1,N,i,f[i-1]-2LL*(ll)X[i]-(ll)X[i-1]);

		modify(tree2,1,1,N,i,f[i-1]-(ll)X[i-1]);

		int l = 0,r = i-1,mid; f[i] = inf;

		while (l <= r)

		{

			mid = (l+r)>>1;

			if (T-2LL*(X[i]-X[mid+1]) > 0) r = mid-1;

			else l = mid+1;

		}

		if (r+1) f[i] = query(tree1,1,1,N,1,r+1)+3LL*X[i];

		if (r+2 <= i) f[i] = min(f[i],query(tree2,1,1,N,r+2,i)+(ll)X[i]+(ll)T);

	}

	cout << f[N]+(ll)E-(ll)X[N] << endl;

	return 0;

}


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

#include<cstring>

#include<algorithm>

using namespace std;

const int N=100005;

typedef long long ll;

const ll INF=1e15;

ll d[N];

int n,m,T;

ll a[N];

int q[N];

int s,t;

int main()

{

    //freopen("computer.in","r",stdin);

    //freopen("computer.out","w",stdout);

    scanf("%d%d%d",&n,&m,&T);

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

        scanf("%lld",&a[i]);

        d[i]=INF;

    }

    if(n<=1000){

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

            for(int j=0;j<i;j++){

                ll f=max(a[i]-a[j+1],T-(a[i]-a[j+1]));

                d[i]=min(d[i],d[j]+a[i]-a[j]+f+max(a[i]-a[j+1],T-f));

            }

        ll ans=d[n]+m-a[n];

        printf("%lld\n",ans);

    }

    else{

        s=1,t=1;

        ll z=INF;

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

            while(s<=t&&2*(a[i]-a[q[s]+1])>T){

                z=min(z,d[q[s]]-a[q[s]]-2*a[q[s]+1]);

                s++;

            }

            d[i]=min(d[i],a[i]+z+2*a[i]);

            //d[i]=min(d[i],d[q[s]]+a[i]-a[q[s]]+2*(a[i]-a[q[s]+1]));

            d[i]=min(d[i],d[q[s]]+a[i]-a[q[s]]+T);

            while(s<=t&&d[q[s]]-a[q[s]]>=d[i]-a[i])

                t--;

            q[++t]=i;

        }

        ll ans=d[n]+m-a[n];

        printf("%lld\n",ans);

    }

}