#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream> 
using namespace std;
long long d[100003],a[100003],q[100003];
int n,m,T,s,t;
int main(){
	cin>>n>>m>>T;
    for(int i=1;i<=n;i++){
    	cin>>a[i];
        d[i]=1e15;
    }
    s=1,t=1;
    long long z=1e15;
    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;
    }
    long long ans=d[n]+m-a[n];
    cout<<ans<<endl;
    return 0;
}