#include <bits/stdc++.h>
using namespace std;
int n;
long long t, e, x[100005], mem[100005], ml[100005];
multiset<long long> s;
int main() {
  scanf("%d%lld%lld", &n, &e, &t);
  for (int i = 0; i < n; i++) scanf("%lld", &x[i]);
  mem[0] = (x[0] + t);
  ml[0] = mem[0] - x[0] - x[1] - x[1];
  int cur = 1;
  for (int i = 1; i < n; i++) {
    mem[i] = max(t, x[i] - x[0] + x[i] - x[0]) + x[i];
    mem[i] = min(mem[i], mem[i - 1] + x[i] - x[i - 1] + t);
    if (i > 1) {
      while (cur < i && x[i] - x[cur] + x[i] - x[cur + 1] > t) {
        s.erase(s.find(mem[cur] - x[cur]));
        cur++;
      }
      mem[i] = min(mem[i], ml[min(cur, i - 1) - 1] + 3ll * x[i]);
      if (!s.empty()) mem[i] = min(mem[i], (*s.begin()) + t + x[i]);
    }
    ml[i] = min(ml[i - 1], mem[i] - x[i] - x[i + 1] - x[i + 1]);
    s.insert(mem[i] - x[i]);
  }
  printf("%lld\n", mem[n - 1] + e - x[n - 1]);
}
