#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const ll INFTY=1e18;

int main() {
    ll i, n, e, t, l, r, m;
    scanf("%lld%lld%lld", &n, &e, &t);
    vll x(n+2);
    for(i=1; i<=n; i++) scanf("%lld", &x[i]);
    x[n+1]=e;
    vll opt(n+2), dp(n+2);
    dp[n+1]=INFTY;
    for(i=n; i>=1; i--) {
        l=i+1; r=n+1;
        while(l<r) {
            m=(l+r)/2;
            if(2*(x[m]-x[i])<=t) l=m+1;
            else r=m;
        }
        opt[i]=min(t+x[l]-x[i]+opt[l], -3*x[i]+dp[l]);
        dp[i]=min(2*x[i]+x[i+1]+opt[i+1], dp[i+1]);
    }
    printf("%lld\n", x[1]+opt[1]);
    return 0;
}