#include <bits/stdc++.h>
using namespace std;
const int nsz = 1e5;
const long long inf = 0x3f3f3f3f3f3f3f3f;
int n, m, t, a[nsz + 5];
long long dp[nsz + 5], ans;
void inline upd(long long &a, long long b) { a > b && (a = b); }
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> t;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  memset(dp, inf, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j) {
      upd(dp[i],
          dp[j] + a[i] - a[j] + a[i] - a[j + 1] +
              max(0, t - (a[i] - a[j] + a[i] - a[j + 1] - a[j + 1] + a[j])) +
              a[i] - a[j + 1]);
    }
  }
  ans = dp[n] + m - a[n];
  cout << ans << '\n';
}
