#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const long long inf = 1e18;
long long x[maxn], dp[maxn];
class node {
 public:
  long long mnm;
  long long lzy;
  long long cng;
  node() { mnm = inf; }
};
node seg[4 * maxn];
void propagate(int, int, int);
long long get(int id, int L, int R, int l, int r) {
  if (L == l and R == r) return seg[id].mnm;
  propagate(id, L, R);
  int mid = (L + R) >> 1;
  long long ret = inf;
  if (mid > l) ret = min(ret, get(2 * id + 0, L, mid, l, min(mid, r)));
  if (mid < r) ret = min(ret, get(2 * id + 1, mid, R, max(l, mid), r));
  return ret;
}
void update(int id, int L, int R, int l, int r, long long val) {
  if (L == l and R == r) {
    seg[id].mnm += val;
    seg[id].lzy += val;
    return;
  }
  propagate(id, L, R);
  int mid = (L + R) >> 1;
  if (mid > l) update(2 * id + 0, L, mid, l, min(mid, r), val);
  if (mid < r) update(2 * id + 1, mid, R, max(l, mid), r, val);
  seg[id].mnm = min(seg[2 * id + 0].mnm, seg[2 * id + 1].mnm);
}
void change(int id, int L, int R, int l, int r, long long val) {
  if (L == l and R == r) {
    seg[id].mnm = val;
    seg[id].cng = val;
    seg[id].lzy = 0;
    return;
  }
  propagate(id, L, R);
  int mid = (L + R) >> 1;
  if (mid > l) change(2 * id + 0, L, mid, l, min(mid, r), val);
  if (mid < r) change(2 * id + 1, mid, R, max(l, mid), r, val);
  seg[id].mnm = min(seg[2 * id + 0].mnm, seg[2 * id + 1].mnm);
}
void propagate(int id, int L, int R) {
  int mid = (L + R) >> 1;
  if (seg[id].cng != 0) change(2 * id + 0, L, mid, L, mid, seg[id].cng);
  if (seg[id].lzy != 0) update(2 * id + 0, L, mid, L, mid, seg[id].lzy);
  seg[id].lzy = seg[id].cng = 0;
}
long long dis(int fi, int se) { return abs(x[fi] - x[se]); }
int main() {
  ios_base::sync_with_stdio(false);
  int n, e, t;
  cin >> n >> e >> t;
  for (int i = 1; i <= n; i++) cin >> x[i];
  memset(dp, 63, sizeof dp);
  dp[0] = 0;
  int ptr = 1;
  for (int i = 1; i <= n; i++) {
    change(1, 1, n + 1, i, i + 1, dp[i - 1] + dis(i - 1, i) + t);
    if (i != 1) update(1, 1, n + 1, 1, i, 3 * dis(i - 1, i));
    if (ptr != i) update(1, 1, n + 1, ptr, i, -2 * dis(i - 1, i));
    while (2 * (x[i] - x[ptr]) > t) {
      update(1, 1, n + 1, ptr, ptr + 1, 2 * dis(ptr, i) - t);
      ptr++;
    }
    dp[i] = get(1, 1, n + 1, 1, i + 1);
  }
  cout << dp[n] + e - x[n] << endl;
}
