#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
multiset<long long>Set1, Set2;
int n, E, T, w[101000];
long long D[101000];
int main(){
    int i, pv = 1;
    scanf("%d%d%d",&n,&E,&T);
    for(i=1;i<=n;i++){
        scanf("%d",&w[i]);
    }
    w[n+1] = E;
    D[1] = w[1];
    for(i=1;i<=n;i++){
        long long r = 1e15, tp;
        Set2.insert(D[i] - w[i]);
        while(pv<=i && (w[i] - w[pv]) * 2 > T){
            Set2.erase(Set2.find(D[pv] - w[pv]));
            Set1.insert(D[pv] - 1ll*3*w[pv]);
            pv++;
        }
        if(!Set1.empty()){
            tp = *Set1.begin();
            if(r > tp + w[i]*3ll) r = tp + w[i]*3ll;
        }
        tp = *Set2.begin();
        if(r > tp + w[i] + T) r = tp + w[i] + T;
        D[i+1] = w[i+1] - w[i] + r;
    }
    printf("%lld\n",D[n+1]);
}
