// Slower C++ solution:
//By Don4ick

//#define _GLIBCXX_DEBUG



#include <bits/stdc++.h>



typedef long long ll;

typedef long double ld;

typedef unsigned int ui;



#define forn(i, n) for (int i = 1; i <= n; i++)

#define pb push_back

#define all(x) x.begin(), x.end()

#define y1 qwer1234



const double PI = acos(-1.0);

const int DIR = 4;

const int X[] = {1, 0, -1, 0};

const int Y[] = {0, 1, 0, -1};



using namespace std;



const int N = 1e5 + 123;

const ll inf = 1e18;



ll n, T, e, dp[N], x[N];

ll t[4 * N][2];



ll get(int v, int tl, int tr, int l, int r,int k){

	if(l > r)

		return inf;

	if(tl == l && tr == r)

		return t[v][k];

	int tm = (tl + tr) / 2;

	return min(get(v + v, tl, tm , l, min(tm, r), k), get(v + v + 1, tm + 1, tr, max(tm + 1, l), r, k));

}



void upd(int v, int tl, int tr, int pos, ll val,int k){

	t[v][k] = min(t[v][k], val);

	if(tl == tr)

		return;

	int tm = (tl + tr) / 2;

	if(pos <= tm)                  

		upd(v + v, tl, tm, pos, val, k);

	else

		upd(v + v + 1, tm + 1, tr, pos, val, k);

}





int main()

{

	//ios_base::sync_with_stdio(false);

	//cin.tie(NULL);

	//cout.tie(NULL);



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

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

	for(int i = 0; i < 4 * N; i++)

		t[i][0] = t[i][1] = inf;

	cin >> n;

	cin >> e >> T;

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

		cin >> x[i];

	

	dp[1] = x[1];

	x[n + 1] = e;

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

        upd(1, 1, n, i, dp[i] - x[i], 0);

		upd(1, 1, n, i, dp[i] - 3 * x[i], 1);  

		                                         

        while(j <= i && max(0ll, T - 2 * (x[i] - x[j])) == 0)

        	j++;

        

        dp[i + 1] = min(T + get(1, 1, n, j, i, 0) + x[i], get(1, 1, n, 1, j - 1, 1) + 3 * x[i]) + x[i + 1] - x[i];

	}

	cout << dp[n + 1];

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.283325376307288x):
#include<bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 5;

int n, t, e, x[maxn];

long long f[maxn];

struct Seg {

	long long tr[maxn << 2];

	inline void Upd(int o, int l, int r, int p, long long d) {

		if(l == r)

			return tr[o] = d, void();

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

		if(p <= mid)

			Upd(o << 1, l, mid, p, d);

		else

			Upd(o << 1 | 1, mid + 1, r, p, d);

		tr[o] = min(tr[o << 1], tr[o << 1 | 1]);

	}

	inline long long Ask(int o, int l, int r, int ql, int qr) {

		if(ql > qr)

			return 1e18;

		if(ql <= l && r <= qr)

			return tr[o];

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

		long long ans = 1e18;

		if(ql <= mid)

			ans = min(ans, Ask(o << 1, l, mid, ql, qr));

		if(qr > mid)

			ans = min(ans, Ask(o << 1 | 1, mid + 1, r, ql, qr));

		return ans;

	}

}g, h;

int main() {

	scanf("%d%d%d", &n, &e, &t);

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

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

	memset(f, 0x3f, sizeof f);

	f[0] = 0, g.Upd(1, 0, n, 0, 0), h.Upd(1, 0, n, 0, - 1ll * 2 * x[1]);

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

		int p = lower_bound(x, x + i, x[i] - t / 2) - x;

		f[i] = min(g.Ask(1, 0, n, p - 1, i - 1) + t + x[i], h.Ask(1, 0, n, 0, p - 2) + 1ll * 3 * x[i]);

		if(i < n)

			g.Upd(1, 0, n, i, f[i] - x[i]), h.Upd(1, 0, n, i, f[i] - x[i] - 1ll * 2 * x[i + 1]);

		

	}

	printf("%lld\n", f[n] + e - x[n]);



}