#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mxn=1e6+6;
int n,E,T,w[mxn];
ll d[mxn];
multiset<ll>s1,s2;
int main(){
	ios_base::sync_with_stdio(false);
	int pv=1;
	cin>>n>>E>>T;
	for(int i=1;i<=n;++i)cin>>w[i];
	w[n+1]=E,d[1]=w[1];
	for(int i=1;i<=n;++i){
		ll r=1e15,tp;
		s2.insert(d[i]-w[i]);
		for(;pv<=i and (w[i]-w[pv])*2>T;){
			s2.erase(s2.find(d[pv]-w[pv]));
			s1.insert(d[pv]-1ll*3*w[pv]);
			++pv;
		}
		if(!s1.empty()){
			tp=*s1.begin();
			if(r>tp+w[i]*3ll)r=tp+w[i]*3ll;
		}
		tp=*s2.begin();
		if(r>tp+w[i]+T)r=tp+w[i]+T;
		d[i+1]=w[i+1]-w[i]+r;
	}
	cout<<d[n+1]<<endl;
}