#include<cstdio>
#include<cstring>
#include<algorithm>
#define LL long long
#define maxn 100005
#define INF (LL)1e16
using namespace std;
int n,m,t,x[maxn];
LL dp[maxn];
int main()
{
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1;i<=n;i++) scanf("%d",&x[i]);
	sort(x+1,x+n+1);
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	LL mn=INF; int now=0;
	for(int i=1;i<=n;i++)
	{
		dp[i]=dp[i-1]+t+x[i]-x[i-1];
		while(2*(x[i]-x[now+1])>=t)
		{
			mn=min(mn,dp[now]-2ll*x[now+1]);
			now++;
		}
		dp[i]=min(2*x[i]+mn,dp[now]+t);
	}
	printf("%lld\n",dp[n]+m);
}
