#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cassert>

using namespace std;

multiset<long long> s;

const int N = 1e5 + 7;
const long long INF = 1LL << 60;

int n, t, e;
long long pos[N], f[N];

int main() {
	scanf("%d %d %d", &n, &e, &t);
	for (int i = 1; i <= n; i++) {
		int x;
		scanf("%d", &x);
		pos[i] = x;
	}
	pos[0] = 0;
	f[0] = 0;
	long long min_v = INF;
	s.insert(f[0] - pos[0]);
	for (int i = 1, j = 0; i <= n; i++) {
		while (2 * pos[j + 1] + t < 2 * pos[i]) {
			min_v = min(min_v, f[j] - 2 * pos[j + 1] - pos[j]);
			if (s.size()) {
				s.erase(s.find(f[j] - pos[j]));
			}
			j++;
		}
		f[i] = min_v + 3 * pos[i];
		if (s.size()) {
			f[i] = min(f[i], *(s.begin()) + pos[i] + t);
		}
		s.insert(f[i] - pos[i]);
	}
	cout << f[n] + e - pos[n] << endl;
}