#include<bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
const ll INF=1e15;
ll d[N],a[N];
int n,m,T,q[N],s,t;
int main() {
    scanf("%d%d%d",&n,&m,&T); for(int i=1;i<=n;i++){ scanf("%lld",&a[i]); d[i]=INF; }
    s=1,t=1;
    ll z=INF;
    for(int i=1;i<=n;i++){
        while(s<=t&&2*(a[i]-a[q[s]+1])>T){ z=min(z,d[q[s]]-a[q[s]]-2*a[q[s]+1]); s++; }
        d[i]=min(d[i],a[i]+z+2*a[i]); d[i]=min(d[i],d[q[s]]+a[i]-a[q[s]]+T);
        while(s<=t&&d[q[s]]-a[q[s]]>=d[i]-a[i]) t--; q[++t]=i;
    }
    ll ans=d[n]+m-a[n];
    printf("%lld\n",ans);
	return 0;
}

