#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#define SF scanf
#define PF printf
#define MAXN 100010
#define INF 0x3FFFFFFF
using namespace std;
typedef long long ll;
ll dp[MAXN],pos[MAXN],m,t,pre=INF;
priority_queue<pair<ll,int> > q;
int n;
int main(){
	SF("%d%lld%lld",&n,&m,&t);
	for(int i=1;i<=n;i++)
		SF("%lld",&pos[i]);
	q.push(make_pair(0,0));
	int las=0;
	for(int i=1;i<=n;i++){
		dp[i]=dp[i-1]+t+pos[i]-pos[i-1];
		while(1){
			pair<ll,int> x=q.top();
			if(2ll*(pos[i]-pos[x.second+1])<=t){
				dp[i]=min(dp[i],-x.first+pos[i]+t);
				break;
			}
			q.pop();
		}
		while(2ll*(pos[i]-pos[las+1])>t){
			pre=min(pre,dp[las]-pos[las]-2ll*pos[las+1]);
			las++;
		}
		if(pre!=INF)
			dp[i]=min(dp[i],pre+3ll*pos[i]);
		q.push(make_pair(-dp[i]+pos[i],i));
	}
	PF("%lld",dp[n]+m-pos[n]);
}