#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,S,T,i,la,now,f[200001],a[200001];
int main(){
	scanf("%lld%lld%lld",&n,&S,&T);
	for(i=1;i<=n;i++)scanf("%lld",&a[i]);
	la=0;now=1e9;
	for(i=1;i<=n;i++){
		while(la<i&&2*(a[i]-a[la+1])>T){
			now=min(now,f[la]-2*a[la+1]);
			la++;
		}
		f[i]=min(2*a[i]+now,f[la]+T);
	}
	f[n]+=a[n]+abs(a[n]-S);
	printf("%lld",f[n]);
}
/*
最后肯定被分成一段段 
*/