//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define int ll

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 1e5 + 20 , inf = 1e18 + 20;
int n , e , t , x[N] , dp[N] , p , mn = inf ;

int32_t main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;

	cin >> n >> e >> t ;
	for (int i = 0 ; i < n ; i ++) cin >> x[i] ;

	p = n ;

	dp[n - 1] = e - x[n - 1] + t ;
	for (int i = n - 2 ; ~i ; i --) {
		while (2 * (x[p - 1] - x[i]) > t){
			p -- ;
			mn = min(mn , dp[p + 1] + ((p == n - 1 ? e : x[p + 1]) - x[p]) + 3 * x[p]) ;
		}

		dp[i] = mn - 3 * x[i] ;

		int len = x[p - 1] - x[i] ;
		dp[i] = min(dp[i] , 3 * len + (t - 2 * len) + (p == n ? e - x[n - 1] : x[p] - x[p - 1] + dp[p])) ;
	}

	cout << x[0] + dp[0] << '\n';
}
