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

int main(){
    int H,W,counter=0;
    cin >> H >> W;

    vector<string> S(H);

    for(int i=0;i<H;i++){
        cin >> S[i];
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(j != W-1){
                if(S[i].at(j) == '.' && S[i].at(j+1) == '.' ){
                    counter++;
                }
            }
           if(i != H-1){
               if(S[i].at(j) == '.' && S[i+1].at(j) == '.'){
                   counter++;
               }
           }
        }
    }
    cout << counter << endl;
}   
#include <bits/stdc++.h>

using ll = long long int;
using P = std::pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rag(con) std::begin(con), std::end(con)

constexpr int MAX = 1510;

int board[MAX][MAX]; //+1:light bulb, 0:normal cell -1:block
bool rl[MAX][MAX], rr[MAX][MAX], cl[MAX][MAX], cr[MAX][MAX];

int main()
{
    int h, w, n, m;
    std::cin >> h >> w >> n >> m;

    rep(i, n)
    {
        int x, y;
        std::cin >> x >> y;
        board[x][y] = 1;
    }

    rep(i, m)
    {
        int x, y;
        std::cin >> x >> y;
        board[x][y] = -1;
    }

    for (int i = 1; i <= h; ++i)
    {
        for (int j = 1; j <= w; ++j)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                rl[i][j] = 1;
            }
            else
                rl[i][j] = rl[i][j - 1];
        }
        for (int j = w; j >= 1; --j)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                rr[i][j] = 1;
            }
            else
                rr[i][j] = rr[i][j + 1];
        }
    }

    for (int j = 1; j <= w; ++j)
    {
        for (int i = 1; i <= h; ++i)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                cl[i][j] = 1;
            }
            else
                cl[i][j] = cl[i - 1][j];
        }
        for (int i = h; i >= 1; --i)
        {
            if (board[i][j] == -1)
                continue;
            if (board[i][j] == 1)
            {
                cr[i][j] = 1;
            }
            else
                cr[i][j] = cr[i + 1][j];
        }
    }

    int ans = 0;

    for (int i = 1; i <= h; ++i)
    {
        for (int j = 1; j <= w; ++j)
        {
            if (rl[i][j] || rr[i][j] || cl[i][j] || cr[i][j])
                ++ans;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}