#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;
    cin >> H >> W;
    char map[H][W];
    rep(i, H) rep(j, W) {
        char c;
        cin >> c;
        map[i][j] = c;
    }
    int count = 0;
    rep(i, H) rep(j, W) {
        if(map[i][j] == '.') {
            if(i+1 < H && map[i+1][j] == '.') count++;
            if(j+1 < W && map[i][j+1] == '.') count++;
        }
    }
    cout << count << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
constexpr int inf=1000001000;
constexpr ll INF=2e18;
constexpr ll mod=1000000007;
// ll MOD=998244353;
constexpr ll MOD=998244353;

int main() {
    int h,w,n,m;
    cin >> h >> w >> n >> m;
    vector<vector<int>> a(w,vector<int>(h,0)),b(w,vector<int>(h,0));
    rep(i,n){
        int f,g;
        cin >> f >> g;
        f--;
        g--;
        a[g][f]=2;
    }
    rep(i,m){
        int f,g;
        cin >> f >> g;
        f--;
        g--;
        a[g][f]=1;
    }
    rep(i,h){
        int u=0;
        rep(j,w){
            if (a[j][i]==2) u=1;
            if (a[j][i]==1) u=0;
            if (u==1) b[j][i]=1;
        }
    }
    rep(i,h){
        int u=0;
        rep(j,w){
            if (a[w-j-1][i]==2) u=1;
            if (a[w-1-j][i]==1) u=0;
            if (u==1) b[w-j-1][i]=1;
        }
    }
    rep(i,w){
        int u=0;
        rep(j,h){
            if (a[i][j]==2) u=1;
            if (a[i][j]==1) u=0;
            if (u==1) b[i][j]=1;
        }
    }
    rep(j,w){
        int u=0;
        rep(i,h){
            if (a[j][h-i-1]==2) u=1;
            if (a[j][h-i-1]==1) u=0;
            if (u==1) b[j][h-i-1]=1;
        }
    }
    int ans=0;
    rep(i,h){
        rep(j,w){
            if (b[j][i]==1) ans++;
        }
    }
    cout << ans << endl;
}
