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

}


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

    }

}