#include <bits/stdc++.h>
using namespace std;
class InParser {
private:
FILE *fin;
char *buff;
int sp;
char read_ch() {
++sp;
if (sp == 4096) {
sp = 0;
fread(buff, 1, 4096, fin);
}
return buff[sp];
}
public:
InParser(const char* nume) {
fin = fopen(nume, "r");
buff = new char[4096]();
sp = 4095;
}
InParser& operator >> (int &n) {
char c;
while (!isdigit(c = read_ch()) && c != '-');
int sgn = 1;
if (c == '-') {
n = 0;
sgn = -1;
} else {
n = c - '0';
}
while (isdigit(c = read_ch())) {
n = 10 * n + c - '0';
}
n *= sgn;
return *this;
}
};
#ifdef INFOARENA
#define cin fin
#define cout fout
InParser fin("ograzi.in");
ofstream fout("ograzi.out");
#endif // INFOARENA
using pii = pair <int, int>;
class LazyBIT2D {
int n, m;
vector <vector <int>> pos, t;
int lsb(int x) { return x & (-x); }
public:
LazyBIT2D(int _n, int _m) : n(_n), m(_m), t(_n + 1), pos(_n + 1) {}
void fake_query(int x, int y) {
for(; x; x -= lsb(x)) if(x <= n)
pos[x].push_back(y);
}
void push() {
for(int i = 1; i <= n; i++) if(pos[i].size()) {
sort(pos[i].begin(), pos[i].end());
auto it = unique(pos[i].begin(), pos[i].end());
pos[i].resize(it - pos[i].begin());
t[i].resize(pos[i].size() + 1, 0);
}
}
void add(int x, int y, int val) {
for(; x <= n; x += lsb(x))
for(int cy = lower_bound(pos[x].begin(), pos[x].end(), y) - pos[x].begin() + 1; cy < t[x].size(); cy += lsb(cy))
t[x][cy] += val;
}
int query(int x, int y) {
int res = 0;
for(; x; x -= lsb(x))
for(int cy = upper_bound(pos[x].begin(), pos[x].end(), y) - pos[x].begin(); cy; cy -= lsb(cy))
res += t[x][cy];
return res;
}
};
const int N = 1e6;
vector <pii> queries;
vector <int> xx, yy;
int lbx(int x) {
return lower_bound(xx.begin(), xx.end(), x) - xx.begin() + 1;
}
int lby(int y) {
return lower_bound(yy.begin(), yy.end(), y) - yy.begin() + 1;
}
int main()
{
int n, m, w, h, x, y;
cin >> n >> m >> w >> h;
queries.resize(n);
map <int, int> compx, compy;
for(int i = 0; i < n; i++) {
cin >> x >> y; x++, y++;
queries[i] = {x, y};
compx[x] = compx[x + w] = compy[y] = compy[y + h] = 1;
}
int kx = 0, ky = 0;
for(auto& p : compx) p.second = ++kx, xx.push_back(p.first);
for(auto& p : compy) p.second = ++ky, yy.push_back(p.first);
LazyBIT2D B(kx, ky);
for(auto [x, y] : queries) {
B.fake_query(x + w, y + h);
B.fake_query(x + w, y);
B.fake_query(x, y + h);
B.fake_query(x, y);
}
B.push();
for(int i = 0; i < m; i++)
cin >> x >> y,
B.add(lbx(x), lby(y), 1),
B.add(lbx(x + w), lby(y), -1),
B.add(lbx(x), lby(y + h), -1),
B.add(lbx(x + w), lby(y + h), 1);
int res = 0;
for(int i = 0; i < n; i++)
res += B.query(compx[queries[i].first + w], compy[queries[i].second + h]) + B.query(compx[queries[i].first], compy[queries[i].second]) -
(B.query(compx[queries[i].first + w], compy[queries[i].second]) + B.query(compx[queries[i].first], compy[queries[i].second + h]));
cout << res;
return 0;
}