#include<cstdio>
#include<cstring>
#include<algorithm>
#define R register
#define MIN(_A,_B) (_A<_B?_A:_B)
using namespace std;
long long n,m,t,s[3000010],kl=-1;
long long f[3000010],g=192608170817;
long long read()
{
	R long long x=0;R char ch=getchar();
	for(;ch>'9'||ch<'0';ch=getchar());
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';return x;
}
int main()
{
	n=read(),m=read(),t=read();
	for(R int i=1;i<=n;i++) s[i]=read();
	sort(s+1,s+n+1);
	for(R int i=1;i<=n;i++){
		while(kl<i&&2*(s[i]-s[kl+2])>=t){
			kl++;
			g=MIN(g,f[kl]-s[kl]-2*s[kl+1]);
		}
		f[i]=MIN(g+3*s[i],f[kl+1]+s[i]-s[kl+1]+t);
	}
	printf("%lld\n",f[n]+m-s[n]);
	return 0;
}
