#include <bits/stdc++.h>
#define REP(a,b) for(int a=0; a<(b); ++a)
#define FWD(a,b,c) for(int a=(b); a<(c); ++a)
#define FWDS(a,b,c,d) for(int a=(b); a<(c); a+=d)
#define BCK(a,b,c) for(int a=(b); a>(c); --a)
#define ALL(a) (a).begin(), (a).end()
#define SIZE(a) ((int)(a).size())
#define VAR(x) #x ": " << x << " "
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll
#define gcd __gcd
#define x first
#define y second
#define st first
#define nd second
#define pb push_back

using namespace std;

template<typename T> ostream& operator<<(ostream &out, const vector<T> &v){ out << "{"; for(const T &a : v) out << a << ", "; out << "}"; return out; }
template<typename S, typename T> ostream& operator<<(ostream &out, const pair<S,T> &p){ out << "(" << p.st << ", " << p.nd << ")"; return out; }

typedef long long LL;
typedef pair<int, int> PII;
typedef long double K;
typedef vector<int> VI;

const int dx[] = {0,0,-1,1}; //1,1,-1,1};
const int dy[] = {-1,1,0,0}; //1,-1,1,-1};

int n, t, e;
long long X[100010];
long long T[100010];
multiset<long long> D, G;

long long minS(const multiset<long long> &M){
	if(M.empty()) return 1000LL*1000*1000*1000 + 3;
	return *M.begin();
}

int main(){
	scanf("%d %d %d", &n, &e, &t);
	FWD(i,1,n+1) scanf("%lld", &X[i]);

	T[0] = 0;
	//D.insert(T[0] - X[0] + t);

	int p = 1;
	FWD(k,1,n+1){
		while(2*(X[k] - X[p+1]) > t){
			D.erase(D.find(T[p] - X[p] + t));
			G.insert(T[p] - X[p+1] - X[p]);
			++p;
		}
		T[k] = min(minS(G) + 3*X[k], minS(D) + X[k]);
		T[k] = min(T[k], max(3*X[k] - 2*X[1], t+X[k]));
		D.insert(T[k] - X[k] + t);
	}
	printf("%lld\n", T[n] + e - X[n]);
	return 0;
}
