#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const ll mod = 1e9+7;
ll mul(ll a,ll b){return ((a%mod)*(b%mod))%mod;}
ll sum(ll a,ll b){return ((a%mod)+(b%mod))%mod;}
ll sub(ll a,ll b){return ((a%mod)-(b%mod))%mod;}
ll power(ll a,ll b){
	ll res = 1;
	while(b){
		if(b&1)res = mul(res,a);
		b >>= 1;
		a = mul(a,a);
	}
	return res;
}
const int maxn = 19;
const int oo = 1e9;
int N,M,memo[1<<maxn],seen[maxn][maxn],chido[1<<maxn];

int dp(int mask){
	if(mask == (1<<N)-1)return 0;
	int &res = memo[mask];
	if(res != -1)return res;
	res = oo;
	int maskinv = 0;
	forn(i,0,N)if(!(mask&(1<<i)))maskinv |= (1<<i);
		
	for(int newmask = maskinv; newmask; newmask=(newmask-1)&maskinv){
		int can = chido[newmask];
		if(can)res = min(res,1+dp(newmask|mask));
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	forn(i,0,(1<<maxn))memo[i] = -1;
	cin >> N >> M;
	forn(i,0,M){
		int u,v; cin >> u >> v; u--; v--;
		seen[u][v] = seen[v][u] = 1;
	}
	forn(i,0,(1<<N)){
		vi act;
		forn(j,0,N)if(i&(1<<j))act.pb(j);
		int can = 1;
		forn(j,0,(int)act.size()){
			forn(k,j+1,(int)act.size()){
				int u = act[j];
				int v = act[k];
				if(seen[u][v] || seen[v][u])continue;
				can = 0;
			}
		}
		chido[i] = can;
	}
	int res = dp(0);
	cout << res << '\n';
	
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/

#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int H, W, N, M;
    cin >> H >> W >> N >> M;
    int mat[H][W];
    rep(i, H) rep(j, W) {
        mat[i][j] = 0;
    }
    vector<P> light;
    rep(i, N) {
        int p1, p2;
        cin >> p1 >> p2;
        light.push_back((P){p1-1, p2-1});
    }
    rep(i, M) {
        int p1, p2;
        cin >> p1 >> p2;
        mat[p1-1][p2-1] = -1;
    }
    int count = 0;
    for(auto p : light) {
        if(mat[p.first][p.second] == 0) {
            count++;
            mat[p.first][p.second] = 1;
            int i = 1;
            while(p.first+i < H && mat[p.first+i][p.second] != -1) {
                mat[p.first+i][p.second] = 1;
                count++;
                i++;
            }
            i = 1;
            while(p.first-i >= 0 && mat[p.first-i][p.second] != -1) {
                mat[p.first-i][p.second] = 1;
                count++;
                i++;
            }
        }
    }
    for(auto p : light) {
        if(mat[p.first][p.second] == 2) continue;
        int i = 1;
        while(p.second+i < W && mat[p.first][p.second+i] != -1) {
            if(mat[p.first][p.second+i] == 0) count++;
            mat[p.first][p.second+i] = 2;
            i++;
        }
        i = 1;
        while(p.second-i >= 0 && mat[p.first][p.second-i] != -1) {
            if(mat[p.first][p.second-i] == 0) count++;
            mat[p.first][p.second-i] = 2;
            i++;
        }
    }
    cout << count << endl;
}