#include <bits/stdc++.h>
using namespace std;
namespace runzhe2000 {
int q[100005], head, tail;
long long f[100005], x[100005];
void main() {
  int n, E, T;
  scanf("%d%d%d", &n, &E, &T);
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  sort(x + 1, x + 1 + n);
  long long pre = 1ll << 60;
  int cur = 1;
  head = 1;
  for (int i = 1; i <= n; i++) {
    for (; 3 * (x[i] - x[cur]) >= T; cur++) {
      ((pre) > (f[cur - 1] - 2 * x[cur]) ? (pre) = (f[cur - 1] - 2 * x[cur])
                                         : 0);
      if (head <= tail && q[head] == cur) head++;
    }
    for (; head <= tail && f[q[tail] - 1] - x[q[tail]] >= f[i - 1] - x[i];
         --tail)
      ;
    q[++tail] = i;
    f[i] = pre + 2 * x[i];
    if (head <= tail)
      ((f[i]) > (f[q[head] - 1] - x[q[head]] + x[i] + T)
           ? (f[i]) = (f[q[head] - 1] - x[q[head]] + x[i] + T)
           : 0);
  }
  printf("%lld\n", f[n] + E);
}
}  // namespace runzhe2000
int main() { runzhe2000::main(); }
