#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const int INF = 1e9;
const double PI = acos(-1);
const int mod = 1000000007;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) {
        cin >> s[i];
    }

    int ans = 0;
    rep(i, h) {
        rep(j, w - 1) {
            if (s[i][j] == '.' && s[i][j + 1] == '.') {
                ans++;
            }
        }
    }
    rep(i, w) {
        rep(j, h - 1) {
            if (s[j][i] == '.' && s[j + 1][i] == '.') {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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




//#define ll long long



int main() {
    ios::sync_with_stdio(false);

    int h, w, x, y;
    cin >> h >> w >> x >> y;
    x--; y--;

    vector<string> vec(h);

    int cnt = 0;
    for (int i = 0; i < h; i++) {
        cin >> vec[i];
    }

    for (int i = x - 1; i >= 0; i--) {
        if (vec[i][y] == '.') {
            cnt++;
        }else break;
    }

    for (int i = x; i < h; i++) {
        if (vec[i][y] == '.') {
            cnt++;
        }else break;
    }


    for (int i = y - 1; i >= 0; i--) {
        if (vec[x][i] == '.') {
            cnt++;
        }else break;
    }

    for (int i = y + 1; i < w; i++) {
        if (vec[x][i] == '.') {
            cnt++;
        }else break;
    }


    cout << cnt << endl;


    return 0;
}