#include <bits/stdc++.h>
using namespace std;
int l, n, p, t, x[100005], y[100005], f[100005], d[100005], cnt, ans, maxx, pos;
int q[100005], hd, tl;
int read() {
  int r = 0, f = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && (c ^ '-')) c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') r = r * 10 + c - '0', c = getchar();
  return r * f;
}
int main() {
  l = read(), n = read(), p = read(), t = read();
  for (int i = 1; i <= n; ++i) x[i] = read(), y[i] = read();
  d[0] = -t;
  for (int i = 1, j = 0; i <= n; ++i) {
    f[i] = f[i - 1], d[i] = d[i - 1];
    while (j < i && d[j] + t <= y[i]) {
      if (f[j] + (y[i] - max(d[j] + t, x[i])) / p >= f[i]) {
        if (f[j] + (y[i] - max(d[j] + t, x[i])) / p > f[i])
          d[i] = y[i] - (y[i] - max(d[j] + t, x[i])) % p;
        else
          d[i] = min(d[i], y[i] - (y[i] - max(d[j] + t, x[i])) % p);
        f[i] = f[j] + (y[i] - max(d[j] + t, x[i])) / p;
      }
      if (j == i - 1 || d[j + 1] + t > y[i]) break;
      ++j;
    }
  }
  printf("%d", f[n]);
  return 0;
}
