#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
ll h, w, n, m;
ll travel(ve<ve<ll>> &arr, ll &x, ll &y, ll inc_x, ll inc_y)
{
    x = x + inc_x, y = y + inc_y;
    if (x < 1 || x > h)
    {
        return 1;
    }
    if (y < 1 || y > w)
    {
        return 1;
    }
    if (arr[x][y] == -1)
    {
        return 1;
    }
    return 2;
}
void light_up1(ve<ve<ll>> &arr, ve<ve<ll>> &visit, ll x1, ll y1)
{
    if (visit[x1][y1] == 1)
    {
        return;
    }
    visit[x1][y1] = 1;
    ll x = x1, y = y1;
    while (true)
    {
        ll val = travel(arr, x, y, 0, 1);
        if (val == 1 || visit[x][y] == 1)
        {
            break;
        }
        else if (val == 2)
        {
            visit[x][y] = 1;
            cc;
        }
    }
    x = x1, y = y1;
    while (true)
    {
        ll val = travel(arr, x, y, 0, -1);
        if (val == 1 || visit[x][y] == 1)
        {
            break;
        }
        else if (val == 2)
        {
            visit[x][y] = 1;
            cc;
        }
    }
}
void light_up2(ve<ve<ll>> &arr, ve<ve<ll>> &visit, ll x1, ll y1)
{
    if (visit[x1][y1] == 1)
    {
        return;
    }
    ll x = x1, y = y1;
    while (true)
    {
        ll val = travel(arr, x, y, 1, 0);
        if (val == 1 || visit[x][y] == 1)
        {
            break;
        }
        else if (val == 2)
        {
            visit[x][y] = 1;
            cc;
        }
    }
    x = x1, y = y1;
    while (true)
    {
        ll val = travel(arr, x, y, -1, 0);
        if (val == 1 || visit[x][y] == 1)
        {
            break;
        }
        else if (val == 2)
        {
            visit[x][y] = 1;
            cc;
        }
    }
}
int main()
{
    FAST
            cin >>
        h >> w >> n >> m;
    ve<ve<ll>> arr(h + 1, ve<ll>(w + 1, 0));
    ve<ve<ll>> visit1(h + 1, ve<ll>(w + 1, 0)), visit2(h + 1, ve<ll>(w + 1, 0));
    rep(i, 0, n)
    {
        ll x, y;
        cin >> x >> y;
        arr[x][y] = 1;
    }
    rep(i, 0, m)
    {
        ll x, y;
        cin >> x >> y;
        arr[x][y] = -1;
    }
    rep(i, 1, h + 1)
    {
        rep(j, 1, w + 1)
        {
            if (arr[i][j] == 1 && visit1[i][j] == 0)
            {
                light_up1(arr, visit1, i, j);
            }
        }
    }
    rep(i, 1, h + 1)
    {
        rep(j, 1, w + 1)
        {
            if (arr[i][j] == 1 && visit2[i][j] == 0)
            {
                light_up2(arr, visit2, i, j);
            }
        }
    }
    ll ans = 0;
    rep(i, 1, h + 1)
    {
        rep(j, 1, w + 1)
        {
            if (visit1[i][j] == 1 || visit2[i][j] == 1)
            {
                ans++;
            }
        }
    }
    cout << ans << "\n";
}

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

int main() {
	// your code goes here
	int h,w,cnt=0;
	cin>>h>>w;
	char wi[101][101];
	for(int i=0;i<h;i++){
	   for(int j=0;j<w;j++){
	       cin>>wi[i][j];
	   }
	}
	for(int i=0;i<h;i++){
	   for(int j=0;j<w;j++){
	       if(wi[i][j]=='.' && wi[i+1][j]=='.')
	        cnt++;
	       if(wi[i][j]=='.' && wi[i][j+1]=='.')
	        cnt++;
	   }
	}
	cout<<cnt<<endl;
	return 0;
}
