#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 100000;
const ll INF = (1ll<<60);
ll dp[MAXN + 5], a[MAXN + 5], T;
int que[MAXN + 5], s, t;
ll f1(int x) {
	return dp[x] - a[x] - 2*a[x+1];
}
ll f2(int x) {
	return T + 2*a[x+1];
}
int main() {
	int N, M;
	scanf("%d%d%lld", &N, &M, &T);
	for(int i=1;i<=N;i++)
		scanf("%lld", &a[i]);
	a[N+1] = M; ll p = INF;
	s = 1, t = 0;
	for(int i=1;i<=N+1;i++) {
		dp[i] = INF;
		while( s <= t && f1(que[t]) + f2(que[t]) >= f1(i-1) + f2(i-1) )
			t--;
		que[++t] = i-1;
		while( s <= t && f2(que[s])-2*a[i] <= 0 ) {
			p = min(p, f1(que[s]));
			s++;
		}
		dp[i] = min(p, f1(que[s]) + f2(que[s]) - 2*a[i]) + 3*a[i];
	}
	printf("%lld\n", min(dp[N+1], dp[N]+M-a[N]));
}