#include <bits/stdc++.h>

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    ll H, W;
    cin >> H >> W;
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N), B(N), C(M), D(M);
    for(i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    vector<vector<ll>> blockRow(H + 1), blockColumn(W + 1);

    for(i = 0; i < M; i++) {
        cin >> C[i] >> D[i];
        blockRow[C[i]].push_back(D[i]);
        blockColumn[D[i]].push_back(C[i]);
    }
    for(i = 0; i < H + 1; i++) {
        blockRow[i].push_back(0);
        blockRow[i].push_back(W + 1);
        sort(blockRow[i].begin(), blockRow[i].end());
    }
    for(i = 0; i < W + 1; i++) {
        blockColumn[i].push_back(0);
        blockColumn[i].push_back(H + 1);
        sort(blockColumn[i].begin(), blockColumn[i].end());
    }
    ll grid1[H + 2][W + 2], grid2[H + 2][W + 2];
    for(i = 0; i < H + 2; i++) {
        for(j = 0; j < W + 2; j++) {
            grid1[i][j] = 0;
            grid2[i][j] = 0;
        }
    }
    for(i = 0; i < N; i++) {
        if(blockRow[A[i]].size() == 2) {
            grid1[A[i]][0]++;
            grid1[A[i]][W + 1]--;
        } else {
            auto p = lower_bound(blockRow[A[i]].begin(), blockRow[A[i]].end(), B[i]);
            if(p == blockRow[A[i]].begin()) {
                grid1[A[i]][(*p) + 1]++;
                grid1[A[i]][(*(p + 1))]--;
            } else if(p == blockRow[A[i]].end()) {
                grid1[A[i]][(*(p - 1)) + 1]++;
                grid1[A[i]][(*(p))]--;
            } else {
                grid1[A[i]][(*(p-1)) + 1]++;
                grid1[A[i]][(*(p))]--;
            }
        }

        if(blockColumn[B[i]].size() == 2) {
            grid2[0][B[i]]++;
            grid2[H + 1][B[i]]--;
        } else {
            auto p = lower_bound(blockColumn[B[i]].begin(), blockColumn[B[i]].end(), A[i]);
            grid2[(*(p-1)) + 1][B[i]]++;
            grid2[(*(p))][B[i]]--;
        }
    }
    //cout << grid1[3][0] << endl;
    unordered_set<ll> st;
    for(i = 1; i < H + 1; i++) {
        for(j = 1; j < W + 1; j++) {
            grid1[i][j] += grid1[i][j - 1];
            if(grid1[i][j] > 0) {
                st.insert(i*5000+ j);
            }
        }
    }
    for(i = 1; i < W + 1; i++) {
        for(j = 1; j < H + 1; j++) {
            grid2[j][i] += grid2[j - 1][i];
            if(grid2[j][i] > 0) {
                st.insert(j * 5000 + i);
            }
        }
    }
    cout << st.size() << endl;
    return 0;
}
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define inf LLONG_MAX>>2
#define MAX 1000000
#define mod 1000000007
#define pb push_back
#define f(i,a,n,x) for ((i)=(a);(i)<(n);(i)+=(x))
#define fd(i,a,n,x) for ((i)=(a);(i)>=(n);(i)-=(x))
#define fi first
#define se second
#define mk make_pair
#define pi pair
#define vt vector
#define ms multiset
#define is insert
#define um unordered_map
using namespace std;
void read(vt<ll> &a,ll n){ll i,temp;f(i,0,n,1){cin>>temp;a.pb(temp);}}
ll fa[MAX];
ll power(ll p,ll q){
    ll res=1;
    p%=mod;
    while(q){
        if (q&1)
            res=(res*p)%mod;
        q>>=1;
        p=(p*p)%mod;
    }
    return res;
}
ll fact(ll n){
    if (n<=1)
        return fa[n]=1;
    if (fa[n])
        return fa[n];
    return fa[n]=(n*fact(n-1))%mod;
}
ll ncr(ll n,ll r){
    if (!r)
        return 1;
    return (((fact(n)*power(fact(n-r),mod-2))%mod)*power(fact(r),mod-2))%mod;
}
char a[1500][1500];
void solve(){
    ll h,w,n,m,i,j,x,y,count=0;
    f(i,0,1500,1)
        f(j,0,1500,1)
            a[i][j]='_';
    cin>>h>>w>>n>>m;
    f(i,0,n,1){
        cin>>x>>y;
        a[x-1][y-1]='X';
    }
    f(i,0,m,1){
        cin>>x>>y;
        a[x-1][y-1]='Y';
    }
    f(i,0,h,1){
        bool flag=false;
        f(j,0,w,1){
            if (a[i][j]=='X')
                flag=true;
            if (a[i][j]=='Y' && flag)
                flag=false;
            if (flag && a[i][j]=='_')
                a[i][j]='L';
        }
    }
    f(i,0,h,1){
        bool flag=false;
        fd(j,w-1,0,1){
            if (a[i][j]=='X')
                flag=true;
            if (a[i][j]=='Y' && flag)
                flag=false;
            if (flag && a[i][j]=='_')
                a[i][j]='L';
        }
    }
    f(j,0,w,1){
        bool flag=false;
        f(i,0,h,1){
            if (a[i][j]=='X')
                flag=true;
            if (a[i][j]=='Y' && flag)
                flag=false;
            if (flag && a[i][j]=='_')
                a[i][j]='L';
        }
    }
    f(j,0,w,1){
        bool flag=false;
        fd(i,h-1,0,1){
            if (a[i][j]=='X')
                flag=true;
            if (a[i][j]=='Y' && flag)
                flag=false;
            if (flag && a[i][j]=='_')
                a[i][j]='L';
        }
    }
    f(i,0,h,1)
        f(j,0,w,1)
            if (a[i][j]=='X' || a[i][j]=='L')
                count++;
    cout<<count<<endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}