#include <bits/stdc++.h>
#define int long long
#define lowbit(x) x & (-x)
using namespace std;
constexpr int maxn = 1000010;
int tr[maxn];
bool vis[maxn];

struct Point {
	int x, y;
	bool operator < (const Point &W) const {
		if (x == W.x) return y < W.y;
		else return x < W.x;
	}
	
	bool operator == (const Point &W) const {
		return x == W.x && y == W.y;
	}
} p[maxn];

void add(int x, int n) {
	for (int i = x; i <= n; i += lowbit(i)) tr[i]++;
}

int query(int x) {
	int ans = 0;
	for (int i = x; i > 0; i -= lowbit(i)) ans += tr[i];
	return ans;
}

void work() {
	int H, W, M;
	cin >> H >> W >> M;
	int x_min = maxn, y_min = maxn;
	for (int i = 1; i <= M; i++) {
		cin >> p[i].x >> p[i].y;
		if (p[i].x == 1) x_min = min(x_min, p[i].y);
		if (p[i].y == 1) y_min = min(y_min, p[i].x);
	}
	// cout << M << endl;
	
	for (int i = x_min + 1; i <= W; i++) p[++M] = {1, i};
	for (int i = y_min + 1; i <= H; i++) p[++M] = {i, 1};
	
	
	sort(p + 1, p + 1 + M);
	M =  unique(p + 1, p + M + 1) - (p + 1);
	
	// for (int i = 1; i <= M; i++) cout << p[i].x << " " << p[i].y << endl;
	int tmp = 0, h = 1;
	for (int i = 1; i <= M; i++) {
		if (!vis[p[i].y]) {
			vis[p[i].y] = 1;
			add(p[i].y, W);
			// cout << "---" << endl;
		}
		
		if (i == M || p[i].x != p[i + 1].x) {
			tmp += query(W) - query(p[h].y - 1);
			h = i + 1;
		}
	}
	cout << 1ll * H * W - tmp << endl;
}

int32_t main() {
	work();
}
#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define endl "\n"

const int N = 105;
int A[N], B[N], C[N], D[N];

int solve(int n, int m, int k){
    int i,j,ans=0;
    unordered_map<int, int> um;
    for(i=0;i<(1 << k);i++){
        um.clear();
        int cnt=0;
        for(j=0;j<k;j++){
            if(i & (1 << j)){
                um[D[j]]++;
            }else{
                um[C[j]]++;
            }
        }
        for(j=0;j<m;j++){
            if(um[A[j]] > 0 && um[B[j]] > 0){
                cnt++;
            }
        }
        ans = max(ans, cnt);
    }
    return ans;
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t;
    t=1;
    //cin>>t;

    while(t--){
        int i,n,m,k;
        cin>>n>>m;
        for(i=0;i<m;i++){
            cin>>A[i]>>B[i];
        }
        cin>>k;
        for(i=0;i<k;i++){
            cin>>C[i]>>D[i];
        }
        cout<<solve(n, m, k)<<endl;
    }
}
