N,E,T=map(int,input().split())
x=list(map(int,input().split()))
x=[0]+x

dp=[0 for i in range(N+1)]
dp[N]=abs(E-x[N])

for i in range(N-1,-1,-1):
    test1=min(max(T,2*x[j]-2*x[i+1])+dp[j]+x[j] for j in range(i+1,N+1))-x[i]
    test2=x[N]-x[i]+T+x[N]-x[i+1]+abs(E-x[N])
    dp[i]=min(test1,test2)

print(dp[0])
