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

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;



const int N = 1e5 + 10;

const long long inf = 1e17 + 7;



int n, E, T, d[N];



struct node {

	int l, r;

	long long max;	

};

	

struct segTree {

	node h[N << 2];

	int p[N];

	

	void build(int x, int l, int r) {

		h[x].l = l; h[x].r = r; h[x].max = -inf;

		if (l == r) {

			p[l] = x;

			return;

		}

		int m = (l + r) / 2, L = x * 2, R = L + 1;

		build(L, l, m); build(R, m + 1, r);

	}

	void init(int n) {

		build(1, 1, n);

	}

	

	void modify(int x, int l, int r, long long k) {

		if (l > r) return;

		if (h[x].l == l && h[x].r == r) {

			h[x].max = max(h[x].max, k);

			return;	

		}

		

		int m = (h[x].l + h[x].r) / 2;

		int L = x * 2, R = L + 1;

		h[L].max = max(h[L].max, h[x].max);

		h[R].max = max(h[R].max, h[x].max);

		

		if (r <= m) modify(L, l, r, k);

		else if (l >= m + 1) modify(R, l, r, k);

		else {

			modify(L, l, m, k);

			modify(R, m + 1, r, k);	

		}

	}

	

	long long getmax(int id) {

		int x = p[id];

		long long res = -inf;

		while (x) {

			res = max(res, h[x].max);

			x /= 2;

		}

		return res;

	}

} a, b;



int Find(int l, int r, long long k) {

	while (l < r) {

		int m = (l + r) / 2;

		if (m == n + 1 || 2 * d[m] >= k) r = m;

		else l = m + 1;

	}

	return l;

}



int main() {

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

	d[0] = 0;

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

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

	a.init(n); b.init(n);

	long long ans = 0;

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

		int t;

		t = Find(i, n + 1, 1LL * T + 2 * d[i]);

		//printf("...%d %d\n", i, t);

		a.modify(1, i, t - 1, ans - 2 * d[i - 1] - T);

		b.modify(1, t, n, ans + 2 * d[i] - 2 * d[i - 1]);

		ans = max(a.getmax(i) + 2 * d[i], b.getmax(i));

		//printf("%d %lld\n", i, ans);

	}

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

	printf("%lld\n", -ans + 2 * d[n] + E);

	return 0;

}