#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <unistd.h>


#define ll long long
#define lst(x) x.size()-1
#define ld long double
#define pr pair<ll,ll>
#define loop(i,n) for(ll i=0 ; i<n ; ++i)
#define rep(i,x,n) for(ll i=x ; i<=n ; ++i)
#define iteloop(type,data,name,it) for(type<data>::iterator it=name.begin() ;it!=name.end() ; ++it)

using namespace __gnu_pbds;
using namespace std;

template<typename T>
using os = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

const ll N=2e3+5,M=1e1+5,MOD=1e9+7,OO=1e9;
int pos[N],n,t,e;
ll memo[N][N];
ll calc(int cur,int frst){
    int d=pos[cur]-pos[frst];
    int res=0;
    if(d*2<t){
        res+=t-2*d;
    }
    return res+2*d;
}
int main(){
    cin.sync_with_stdio(false), cin.tie(0) , cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "rt" , stdin);
    // freopen("in.txt", "wt" , stdout);
#endif // ONLINE_JUDGE
    cin>>n>>e>>t;
    loop(i,n){
        cin>>pos[i];
    }
    for(int cur=n-1 ; ~cur ; cur--){
        for(int frst=cur ; ~frst ; frst--){
            if(cur==n-1){
                memo[cur][frst]=calc(cur,frst)+memo[cur+1][cur+1];
            }else {
//                if(cur==1 && frst==0){
//                    cout<<memo[cur + 1][frst] + pos[cur + 1] - pos[cur]<<endl;
//                    cout<<calc(cur, frst) + memo[cur + 1][cur + 1]<<endl;
//                }
                memo[cur][frst] = min(memo[cur + 1][frst] ,
                                      calc(cur, frst) + memo[cur + 1][cur + 1])+pos[cur + 1] - pos[cur];
            }
          //  cout<<cur<<" "<<frst<<" "<<memo[cur][frst]<<endl;
        }
    }
  //  cout<<memo[0][0]<<endl;
    cout<<memo[0][0]+e-pos[n-1]+pos[0]<<endl;
}