#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int qdist[maxn], qans[maxn];
int L, n, p, t;
void update(int x, int y, int &tdist, int &tans, int d, int a) {
  int cnt = (y - max(x, d + t)) / p;
  a += cnt;
  d = max(x, d + t) + cnt * p;
  if (tans < a || (tans == a && tdist > d)) {
    tdist = d;
    tans = a;
  }
}
int main() {
  scanf("%d%d%d%d", &L, &n, &p, &t);
  int ans = 0;
  int front = 0, tail = 0;
  qdist[tail] = -t;
  qans[tail] = 0;
  tail++;
  int x, y, tdist, tans;
  while (n--) {
    scanf("%d%d", &x, &y);
    tdist = y;
    tans = 0;
    front = max(front - 1, 0);
    while (front < tail) {
      if (qdist[front] + t + p > y) break;
      update(x, y, tdist, tans, qdist[front], qans[front]);
      front++;
    }
    if (ans < tans) {
      ans = tans;
      qdist[tail] = tdist;
      qans[tail] = tans;
      tail++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
