#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int s[1505][1505];
int t[1505][1505];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int h,w,n,m,ans = 0;
    cin >> h >> w >> n >> m;
    vector<int> a(n),b(n);
    rep(i,n){
        cin >> a[i] >> b[i];
        a[i]--;b[i]--;
    }
    rep(i,m){
        int c,d;
        cin >> c >> d;
        c--;d--;
        s[c][d] = 2;
        t[c][d] = 2;
    }
    rep(i,n){
        // 現時点から横
        int x = a[i];
        int y = b[i];
        s[x][y] = 1;
        while(y - 1 >= 0 && s[x][y-1] == 0){
            s[x][y-1] = 1;
            y--;
        }

        y = b[i];

        while( y + 1 < w && s[x][y+1] == 0){
            s[x][y+1] = 1;
            y++;
        }
    }
    rep(i,n){
        // 現時点から縦
        int x = a[i];
        int y = b[i];
        t[x][y] = 1;
        while(x-1 >=0 && t[x-1][y] == 0){
            t[x-1][y] = 1;
            x--;
        }
        x = a[i];
        while(x + 1 < h && t[x+1][y] == 0){
            t[x+1][y] = 1;
            x++;
        }
    }
    rep(i,h)rep(j,w){
        if(s[i][j] == 1){
            ans++;
        }
        else if(t[i][j] == 1){
            ans++;
        }
    }
    cout << ans << endl;
}
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;


using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int N;
vector<int> E[200001];
pair<int, int> dfs(int u, int prev) {
	int saidai = 0;
	int ind = -1, p = u;
	rep(i, E[u].size()) {
		int to = E[u][i];
		if (to != prev) {
			auto tmp = dfs(to, u);
			if (tmp.first > saidai) {
				saidai = tmp.first;
				ind = i;
				p = tmp.second;
			}
		}
	}
	int saigo = E[u].size();
	if(ind != -1) swap(E[u][saigo - 1], E[u][ind]);

	return { saidai + 1, p };
}

int kotae[200001], k;
void dfs2(int u, int prev) {
	k++;
	kotae[u] = k;

	for (int to : E[u]) if (to != prev) {
		dfs2(to, u);
	}

	k++;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	cin >> N;
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		E[a].pb(b);
		E[b].pb(a);
	}

	auto tmp = dfs(1, -1);
	dfs(tmp.second, -1);

	dfs2(tmp.second, -1);

	rep1(i, N) cosp(kotae[i]);

	Would you please return 0;
}