//This is getting accepted!
// I HATE BUG
// God Of The Bugs
// 12/11/2015
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll
#define ld long double

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}
template<class T> T sqr(T x) { return x * x; }

inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}

int N, E;
ll a[MAXN], dp[MAXN], T;
set<pair<ll, ll> > s[2];

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("inp.txt", "r", stdin);
////    freopen("out.txt", "w", stdout);
//#endif

	scanf("%d%d%d", &N, &E, &T);
	for (int i=0; i<N; i++) scanf("%d", &a[i]);
	
	for (int i=0; i<N; i++) dp[i] = oo;
	int cur = 0;
//	s[0].insert(mp(T, 0));
	for (int i=0; i<N; i++) {
		while (cur <= i && (a[i] - a[cur]) * 2 >= T) {
			int now = T - (cur != 0 ? a[cur - 1] : 0) + (cur != 0 ? dp[cur - 1] : 0);
			
			int nxt = -2 * a[cur] - (cur != 0 ? a[cur - 1] : 0) + (cur != 0 ? dp[cur - 1] : 0);
			if (s[0].find(mp(now, cur)) != s[0].end()) {
				s[0].erase(mp(now, cur));
				s[1].insert(mp(nxt, cur));
			}
			cur++;
		}
		dp[i] = a[i] - (i != 0 ? a[i-1] : 0) + (i != 0 ? dp[i-1] : 0) + T;
//		if (i == 1) cout << dp[1] << endl;
		if (!s[0].empty()) {
			int now = s[0].begin()->FI;
			dp[i] = min(dp[i], a[i] + now);
		}
//		if (i == 2) cout << dp[i] << endl;
		if (!s[1].empty()) {
			int now = s[1].begin()->FI;
			dp[i] = min(dp[i], 3 * a[i] + now);			
		}
		int nxt = T - (i != 0 ? a[i - 1] : 0) + (i != 0 ? dp[i - 1] : 0);
		s[0].insert(mp(nxt, i));
	}
//	cout << dp[1] << endl;
	cout << E - a[N - 1] + dp[N - 1];


}
