#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
namespace Segment_tree {
template <typename T>
class segment_tree {
  vector<T> dat;
  int n;
  T e;
  std::function<T(T, T)> f;
  T query_implement(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return dat[k];
    T v1 = query_implement(a, b, 2 * k + 1, l, (l + r) / 2);
    T v2 = query_implement(a, b, 2 * k + 2, (l + r) / 2, r);
    return f(v1, v2);
  }

 public:
  segment_tree(int n_, T _e, T (*calc)(T lhs, T rhs)) {
    e = _e;
    f = calc;
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1);
    for (int i = 0; i < 2 * n - 1; i++) dat[i] = e;
  }
  void update(int k, int a) {
    k += n - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = f(dat[k * 2 + 2], dat[k * 2 + 1]);
    }
  }
  T query(int a, int b) { return query_implement(a, b, 0, 0, n); }
};
}  // namespace Segment_tree
long long int f(long long int i, long long int j) { return min(i, j); }
int main() {
  long long int n, e, t;
  cin >> n >> e >> t;
  vector<long long int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<long long int> dp(n, 0);
  dp[0] = x[0] + t;
  Segment_tree::segment_tree<long long int> seg(n, 1e10, f);
  for (int i = 1; i < n; i++) {
    long long int res = dp[i - 1] + x[i] - x[i - 1] + t;
    res = min(res, x[i] + x[i] - x[0] + max(0LL, t - 2 * (x[i] - x[0])) + x[i] -
                       x[0]);
    int index = lower_bound(x.begin(), x.end(), x[i] - double(t) / 2 + 0.001) -
                x.begin();
    if (index >= i) index = i - 1;
    index--;
    if (index > 0) res = min(res, dp[index] - 2 * x[index] - x[index + 1]);
    index = lower_bound(x.begin(), x.end(), x[i] - double(t) / 2 + 0.001) -
            x.begin();
    if (index < i - 1) {
      long long int a = seg.query(index, i - 1);
      res = min(res, a + x[i]);
    }
    dp[i] = res;
    if (i < n - 1)
      seg.update(i, dp[i] - 2 * x[i] - x[i + 1] + t - 2 * x[i + 1]);
  }
  cout << dp[n - 1] + e - x[n - 1] << endl;
  return 0;
}
