#include <bits/stdc++.h>
#define endl '\n'
#define modulo 1000000007
#define int long long
#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
#define EPS 0.000000001
using namespace std;
int power(int x,int y,int m)
{
int temp;
if(y == 0)
return 1;
temp = (power(x, y/2,m))%m;
if (y%2 == 0)
return ((temp%m)*temp);
else
return ((x*temp%m)*temp%m)%m;
}
int inv(int x)
{
return (power(x,modulo-2,modulo))%modulo;
}
int pos[1501][1501],arr[500001],arr2[500001];
void DFS(int X,int Y,int DIR){
if(X>1500||Y>1500||X<0||Y<0)
return;
if((pos[X][Y]==1)||pos[X][Y]==2)
return;
if(pos[X][Y]==DIR)
return;
pos[X][Y]=DIR;
if(DIR==3)
DFS(X+1,Y,3);
else if(DIR==4)
DFS(X-1,Y,4);
else if(DIR==5)
DFS(X,Y+1,5);
else
DFS(X,Y-1,6);
}
int32_t main()
{
//freopen("output.txt","w",stdout);
//freopen("colors.in","r",stdin);
cin.tie(0),iostream::sync_with_stdio(0);
int x,y,n,m,X,Y;
cin>>x>>y>>n>>m;
for(int i=0;i<n;i++){
cin>>X>>Y;
X--,Y--;
pos[X][Y]=1;
arr[i]=X,arr2[i]=Y;
}
for(int i=0;i<m;i++){
cin>>X>>Y;
X--,Y--;
pos[X][Y]=2;
}
for(int i=0;i<n;i++){
DFS(arr[i]+1,arr2[i],3),DFS(arr[i]-1,arr2[i],4),DFS(arr[i],arr2[i]+1,5),DFS(arr[i],arr2[i]-1,6);
}
int counter=0;
for(int i=0;i<x;i++){
for(int l=0;l<y;l++)
counter+=((pos[i][l]>=3)?1:0);
}
cout<<counter+n;
return 0;
}

#include <bits/stdc++.h>

using namespace std;
using i64 = long long;

const i64 N = 1000, G = 30;

struct Node {
    //0:up 1:right 2:down 3:left
    double cost[4] = {4500, 4500, 4500, 4500};
};

i64 dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

Node node[G][G];

int main() {
    for (i64 turn = 1; turn <= N; turn++) {
        i64 s[2], t[2];
        cin >> s[0] >> s[1] >> t[0] >> t[1];
        vector<vector<i64>> cost(G, vector<i64>(G, 1e9));
        vector<vector<pair<i64, i64>>> bef(G, vector<pair<i64, i64>>(G, {-1, -1}));
        cost[s[0]][s[1]] = 0;
        priority_queue<tuple<i64, i64, i64>, vector<tuple<i64, i64, i64>>, greater<tuple<i64, i64, i64>>> que;
        que.push({0, s[0], s[1]});
        while (que.size()) {
            auto[c, x, y] = que.top();
            que.pop();
            if (cost[x][y] < c) {
                continue;
            }
            for (i64 i = 0; i < 4; i++) {
                i64 ddx = x + dx[i], ddy = y + dy[i];
                if (ddx < 0 || G <= ddx || ddy < 0 || G <= ddy) {
                    continue;
                }
                i64 randCost = node[x][y].cost[i] * pow(((double) turn / N), 2);
                if (cost[x][y] + randCost < cost[ddx][ddy]) {
                    cost[ddx][ddy] = cost[x][y] + randCost;
                    bef[ddx][ddy] = {x, y};
                    que.push({cost[ddx][ddy], ddx, ddy});
                }
            }
        }
        string ans;
        int nowX = t[0], nowY = t[1];
        while (nowX != s[0] || nowY != s[1]) {
            if (nowX - 1 == bef[nowX][nowY].first) {
                ans += "D";
                nowX--;
            } else if (nowX + 1 == bef[nowX][nowY].first) {
                ans += "U";
                nowX++;
            } else if (nowY - 1 == bef[nowX][nowY].second) {
                ans += "R";
                nowY--;
            } else if (nowY + 1 == bef[nowX][nowY].second) {
                ans += "L";
                nowY++;
            }
        }
        reverse(ans.begin(), ans.end());
        cout << ans << endl;
        double length;
        cin >> length;
        length /= ans.size();
        for (char i:ans) {
            if (i == 'D') {
                node[nowX][nowY].cost[3] += length;
                node[nowX][nowY].cost[3] /= 2;
                nowX++;
                node[nowX][nowY].cost[1] += length;
                node[nowX][nowY].cost[1] /= 2;
            } else if (i == 'U') {
                node[nowX][nowY].cost[1] += length;
                node[nowX][nowY].cost[1] /= 2;
                nowX--;
                node[nowX][nowY].cost[3] += length;
                node[nowX][nowY].cost[3] /= 2;
            } else if (i == 'R') {
                node[nowX][nowY].cost[0] += length;
                node[nowX][nowY].cost[0] /= 2;
                nowY++;
                node[nowX][nowY].cost[2] += length;
                node[nowX][nowY].cost[2] /= 2;
            } else if (i == 'L') {
                node[nowX][nowY].cost[2] += length;
                node[nowX][nowY].cost[2] /= 2;
                nowY--;
                node[nowX][nowY].cost[0] += length;
                node[nowX][nowY].cost[0] /= 2;
            }
        }
    }
    return 0;
}
