#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 1<<20;
ll n, t, e, x[maxn], dp[maxn];
int main() {
	dp[0] = x[0] = 0;
	cin >> n >> e >> t;
	for(int i = 1; i <= n; i++) cin >> x[i];
	int j = 0;
	multiset<ll> p, s;
	for(int j = 1, i = 1; i <= n; i++) {
		while(2*(x[i]-x[j]) > t) {
			s.erase(s.find(dp[j-1] - x[j] + (x[j] - x[j-1])));
			p.insert(dp[j-1] - 3ll*x[j] + (x[j] - x[j-1]));
			//cout << j << " p " << (dp[j-1] - 3ll*x[j] + (x[j] - x[j-1])) << '\n';
			j++;
		}
		dp[i] = dp[i - 1] + (x[i] - x[i-1]) + t;
		if(!s.empty()) dp[i] = min(dp[i], *s.begin() + x[i] + t);
		if(!p.empty()) dp[i] = min(dp[i], *p.begin() + 3ll*x[i]);
		s.insert(dp[i-1] - x[i] + (x[i] - x[i-1]));
		//cout << i << " s " << (dp[i-1] - x[i] + (x[i] - x[i-1])) << '\n';
		//cout << i << " " << dp[i] << " " << x[i] << " " << t << "\n";
	}
	cout << dp[n]+(e-x[n]);
}
