// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 9.315737073853747x):
#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);

    }

}