#include <bits/stdc++.h>
long N, E, T;
long x[100001];
int main() {
  long i, j;
  long a, b, c;
  long now;
  long tmp;
  long mid;
  long left;
  long right;
  scanf("%ld", &N);
  scanf("%ld", &E);
  scanf("%ld", &T);
  for (i = 1; i <= N; i++) {
    scanf("%ld", &x[i]);
  }
  a = now = 0;
  for (i = 1; i <= N; i++) {
    a += x[i] - now;
    a += T;
    now = x[i];
  }
  a += labs(E - now);
  b = x[N] + T;
  b += x[N] - x[1];
  b += labs(E - x[1]);
  a = (((a) < (b)) ? (a) : (b));
  b = x[N];
  b += x[N] - x[1];
  tmp = T - x[N] + x[1];
  b += (((0) > (tmp - x[N] + x[1])) ? (0) : (tmp - x[N] + x[1]));
  b += x[N] - x[1];
  b += labs(E - x[N]);
  a = (((a) < (b)) ? (a) : (b));
  i = 1;
  b = x[1];
  while (i < N) {
    for (j = i + 1; j <= N; j++) {
      if ((x[j] - x[i]) * 2 >= T) {
        break;
      }
    }
    b += (x[j] - x[i]) * 3;
    if (j == N - 1) {
      c = b;
      c -= (x[j] - x[i]) * 3;
      c += (x[N] - x[i]) * 3;
      c += labs(E - x[N]);
      a = (((a) < (c)) ? (a) : (c));
      break;
    }
    if (j == N) break;
    i = j + 1;
  }
  if (j == N - 1) {
    b += (x[N] - x[j]);
    b += T;
    b += labs(E - x[N]);
    a = (((a) < (b)) ? (a) : (b));
  } else {
    b += labs(E - x[N]);
    a = (((a) < (b)) ? (a) : (b));
  }
  printf("%ld\n", a);
  return 0;
}
