#include <bits/stdc++.h>
using namespace std;
const int maxn = 500010, inf = 1e9 + 233;
int n, T, e;
long long p[maxn], f[maxn], mn[maxn];
multiset<long long> s;
int main() {
  scanf("%d%d%d", &n, &e, &T);
  for (int i = 1; i <= n; i++) scanf("%lld", &p[i]);
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  s.insert(0);
  mn[0] = -2 * p[1];
  int now = 0;
  for (int i = 1; i <= n; i++) {
    while (now < i && 2 * (p[i] - p[now + 1]) >= T)
      s.erase(f[now] - p[now]), now++;
    if (s.size()) f[i] = min(f[i], *s.begin() + p[i] + T);
    if (now) f[i] = min(f[i], mn[now - 1] + p[i] + 2 * p[i]);
    s.insert(f[i] - p[i]);
    mn[i] = min(mn[i - 1], f[i] - p[i] - 2 * p[i + 1]);
  }
  printf("%lld\n", f[n] + e - p[n]);
}
