#include <bits/stdc++.h>
const double PI = acos(-1.0);
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
inline T Min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T Max(T a, T b) {
  return a > b ? a : b;
}
using namespace std;
int p, q, l, r;
struct Seg {
  int l, r;
};
Seg z[1100];
int vis[3100];
int id[3100];
int main() {
  while (scanf("%d%d%d%d", &p, &q, &l, &r) != EOF) {
    int a, b, c, d;
    memset(vis, 0, sizeof vis);
    memset(id, -1, sizeof id);
    int mmax = -1;
    for (int i = 0; i < p; i++) {
      scanf("%d%d", &z[i].l, &z[i].r);
      mmax = Max(mmax, z[i].r);
      for (int j = z[i].l; j <= z[i].r; j++) {
        vis[j] = 1;
        id[j] = i;
      }
    }
    int ans = 0;
    int rec[3100];
    memset(rec, 0, sizeof rec);
    for (int i = 0; i < q; i++) {
      scanf("%d%d", &a, &b);
      int dis = b - a;
      if (a + l > mmax) continue;
      for (int j = a + l; j <= a + r; j++) {
        if (rec[j - a]) continue;
        if (vis[j] && !rec[j - a]) {
          rec[j - a] = 1;
          ans++;
        } else {
          if (vis[j + dis] && !rec[j - a]) {
            rec[j - a] = 1;
            ans++;
          } else {
            int tmp = j;
            while (id[tmp] == -1 && tmp < 1100) tmp++;
            if (id[tmp] == -1) continue;
            if (j < z[id[tmp]].l && j + dis > z[id[tmp]].r && !rec[j - a]) {
              ans++;
              rec[j - a] = 1;
            } else if (j > z[id[tmp]].l && j + dis < z[id[tmp]].r &&
                       !rec[j - a]) {
              ans++;
              rec[j - a] = 1;
            }
          }
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
