#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n);i++)
#define Graph vector<vector<int>>;
#define iterG(next_v, G, v) for(auto next_v : G[v]
#define ALL(a)  (a).begin(),(a).end()
const int MOD = 1000000007;
const int MAX = 510000;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w, x, y;
    cin >> h >> w >> y >> x;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    int ans = 1;
    int curx, cury;
    curx = x-1;
    cury = y-1;
    // x +
    while(curx + 1 < w and s[cury][curx+1] == '.'){
        curx++;
        ans++;
    }

    curx = x-1;
    cury = y-1;
    // x +
    while(curx - 1 >= 0 and s[cury][curx-1] == '.'){
        curx--;
        ans++;
    }
    curx = x-1;
    cury = y-1;

    while(cury + 1 < h and s[cury+1][curx] == '.'){
        cury++;
        ans++;
    }

    curx = x-1;
    cury = y-1;
    while(cury - 1 >= 0 and s[cury-1][curx] == '.'){
        cury--;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
 
int ri() {
	int n;
	cin >> n;
	return n;
}
int main() {
	int h = ri();
	int w = ri();
	int x = ri() - 1;
	int y = ri() - 1;
	string s[h];
	for (auto &i : s) cin >> i;
	
	int cnt = -3;
	for (int i = x; i < h && s[i][y] != '#'; i++) cnt++;
	for (int i = x; i >= 0 && s[i][y] != '#'; i--) cnt++;
	for (int j = y; j < w && s[x][j] != '#'; j++) cnt++;
	for (int j = y; j >= 0 && s[x][j] != '#'; j--) cnt++;
	cout << cnt << endl;
}