#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,t,e,a[100100],f[100100],mn=0x3f3f3f3f;
deque<int>q;
signed main(){
	scanf("%lld%lld%lld",&n,&e,&t);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	q.push_back(0);
	for(int i=1,j=0;i<=n;i++){
		while(j+1<i&&t-2*a[i]+2*a[j+1]<0)mn=min(mn,f[j]-a[j]-2*a[j+1]),j++;
		while(!q.empty()&&q.front()<j)q.pop_front();
		while(!q.empty()&&f[i-1]-a[i-1]<=f[q.back()]-a[q.back()])q.pop_back();
		q.push_back(i-1);
		f[i]=min(f[q.front()]-a[q.front()]+a[i]+t,mn+3*a[i]);
	}
	printf("%lld\n",f[n]+e-a[n]);
	return 0;
}