#include<iostream>
using namespace std;
char a[400][400];
int n,m,x,y;
int  main()
{
//  string s;
	cin>>n>>m;
	cin>>x>>y;
//	getchar();
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	cin>>a[i][j];
//	for(int i=1;i<)
//    cout<<a[1][1]<<" "<<a[1][4]<<endl;
	int ans=1;
	for(int i=x+1;i<=n;i++)
	{
		if(i>n || a[i][y]=='#') break;
		else ans++;
	}
	for(int i=x-1;i>=1;i--)
	if(i<1 || a[i][y]=='#') break;
	else ans++;
	for(int i=y+1;y<=m;i++)
	if(i>m||a[x][i]=='#') break;
	else ans++;
	for(int i=y-1;i>=1;i--)
	if(i<1||a[x][i]=='#') break;
	else ans++;
	cout<<ans; 
//  cin>>s;
}
/*
Code by: tush_chen
*/

#include <bits/stdc++.h>

using namespace std;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int) (x).size())
#define endl '\n'

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pi;

void solve() {
    //Test case code goes here

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

    vector < vi > grid(h, vi(w));
    vector < vi> other(w, vi(h));

    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j) {
            char c;
            cin >> c;
            if (c == '#') {
                grid[i][j] = 1;
                other[j][i] = 1;
            }
            else {
                grid[i][j] = 0;
                other[j][i] = 0;
            }
        }
    }

    int cnt = 0;
    ll ans = 0;

    for (int j = y; j >= 0; --j) {
        if (grid[x][j] == 1) {
            break;
        }
        else {
            ++cnt;
        }
    }

    for (int j = y; j < w; ++j) {
        if (grid[x][j] == 1) {
            break;
        }
        else {
            ++cnt;
        }
    }

    ans += cnt;
    --ans;

    cnt = 0;

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

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

    ans += cnt;
    --ans;
    --ans;

    cout << ans << endl;

}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);

    // Code goes here
    int t;
    // cin >> t;
    t = 1;

    while (t--) {
        solve();
    }

    return 0;
}
