#include <bits/stdc++.h>
long long MOD = 1e9 + 7;
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
template <typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val) {
  fill((T *)array, (T *)(array + NNN), val);
}
struct SegmentTree {
 private:
  int n;
  vector<long long> node;

 public:
  SegmentTree(int sz) {
    n = 1;
    while (n < sz) n *= 2;
    node.resize(2 * n - 1, 1e17 + 7);
  }
  void update(int x, long long val) {
    x += (n - 1);
    node[x] = val;
    while (x > 0) {
      x = (x - 1) / 2;
      node[x] = min(node[2 * x + 1], node[2 * x + 2]);
    }
  }
  long long getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b <= l) return 1e17 + 7;
    if (a <= l && r <= b) return node[k];
    long long vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
    long long vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
  long long rmq(int a, int b) { return getmin(a, b, 0, 0, -1); }
};
int main() {
  long long n = lin(), e = lin(), t = lin();
  long long x[100001] = {};
  for (long long i = 1; i <= n; ++i) x[i] = lin();
  long long dp[100001] = {};
  SegmentTree seg1(n + 1), seg2(n + 1);
  seg1.update(0, -x[1] * 2);
  seg2.update(0, 0);
  for (long long i = 1; i <= n; ++i) {
    int l = 0, r = i - 1;
    while (l < r - 1) {
      int mid = (l + r) / 2;
      if (t - (x[i] - x[mid + 1]) * 2 > 0) {
        r = mid;
      } else
        l = mid;
    }
    long long m1 = seg1.rmq(0, r);
    long long m2 = seg2.rmq(r, i) + t - x[i] * 2;
    dp[i] = 3 * x[i] + min(m1, m2);
    seg1.update(i, dp[i] - (x[i] + 2 * x[i + 1]));
    seg2.update(i, dp[i] - x[i]);
  }
  cout << dp[n] + (e - x[n]);
}
