#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
const int INF = 1e9;
struct Interval {
  int l, r;
  Interval(int l_, int r_) : l(l_), r(r_) {}
  Interval() {}
} intervals[maxn];
int L, n, p, t;
int dp[maxn];
int pause[maxn];
bool check(int a, int b) {
  if (intervals[b].l - pause[a] >= t) return false;
  return true;
}
int main() {
  while (~scanf("%d%d%d%d", &L, &n, &p, &t)) {
    for (int i = 0; i < n; i++) scanf("%d%d", &intervals[i].l, &intervals[i].r);
    memset(dp, 0, sizeof(dp));
    fill(pause, pause + maxn, INF);
    int res = (intervals[0].r - intervals[0].l) / p;
    dp[0] = res;
    pause[0] = res * p + intervals[0].l;
    for (int i = 1; i < n; i++) {
      int tl = intervals[i].l;
      int tr = intervals[i].r;
      int j = i - 1;
      while (check(j, i) && j >= 0) j--;
      int tmp = j;
      j++;
      if (j >= i) {
        int res = (tr - tl) / p;
        int e = tl + res * p;
        if (res + dp[i - 1] > dp[i] ||
            (res + dp[i - 1] == dp[i] && e < pause[i])) {
          dp[i] = res + dp[i - 1];
          pause[i] = e;
        }
      }
      for (; j < i; j++) {
        int s = max(tl, pause[j] + t);
        int res = (tr - s) / p;
        int e = s + res * p;
        if (dp[j] + res > dp[i] || (dp[j] + res == dp[i] && e < pause[i])) {
          dp[i] = dp[j] + res;
          pause[i] = e;
        }
      }
      int res = (tr - tl) / p;
      int e = tl + res * p;
      int preVal;
      if (tmp < 0)
        preVal = 0;
      else
        preVal = dp[tmp];
      if (res + preVal > dp[i] || (res + preVal == dp[i] && e < pause[i])) {
        dp[i] = res + preVal;
        pause[i] = e;
      }
      if (dp[i] <= dp[i - 1]) {
        dp[i] = dp[i - 1];
        pause[i] = pause[i - 1];
      }
    }
    printf("%d\n", dp[n - 1]);
  }
  return 0;
}
