#include <iostream>
#include <algorithm>

#define rep(i,N) for(int i=0;i<N;i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
using namespace std;
typedef long long ll;
#define PInt std::pair<int,int>

int main(void){
  int H,W,N,M;
  cin >> H >> W >> N >> M;
  enum kind{
    EMPTY,
    BLOCK,
    LIGHT,
    MAX
  };
  
  int h,w;
  kind stage[1500][1500];
  rep(i,H)rep(j,W)stage[i][j]=EMPTY;
  rep(i,N){
    cin >> h >> w;
    stage[h-1][w-1]=LIGHT;
  }
  rep(i,M){
    cin >> h >> w;
    stage[h-1][w-1]=BLOCK;
  }
  
  int res =0;
  int dh[]={-1,0,1,0},dw[]={0,-1,0,1};
  rep(i,H)rep(j,W){
    if(stage[i][j]==EMPTY){
      
      int flag = 0;
      rep(d,4){
        h=i,w=j;
        while(0<=h && h <H && 0<=w && w < W && stage[h][w]==EMPTY){
          h+=dh[d];
          w+=dw[d];
        }
        if(!(0<=h && h <H && 0<=w && w < W) || stage[h][w]==BLOCK){
          //届いてないので次
          flag++;
        }else{
          break;
        }
      }
      if(flag == 4){
        res++;
      }
    }
  }
  
  cout << ((ll)H*(ll)W-(ll)(M+res)) << endl;
    
  return 0;
}
#include <bits/stdc++.h>
using namespace std;

// #include <atcoder/all>
// using namespace atcoder;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;


void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){
    vector<vector<int>> e(N);
    rep(i, M) {
        A[i]--;
        B[i]--;
        e[A[i]].push_back(B[i]);
    }
    ll ans = 0;
    rep(i, N) {
        set<int> seen;
        queue<int> q;
        seen.insert(i);
        q.push(i);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            for (int u: e[v]) {
                if (seen.count(u)) continue;
                seen.insert(u);
                q.push(u);
            }
        }
        ans += seen.size();
    }
    cout << ans << endl;
}

// Generated by 2.3.1 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    std::scanf("%lld", &N);
    long long M;
    std::scanf("%lld", &M);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        std::scanf("%lld", &A[i]);
        std::scanf("%lld", &B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}
