#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1010000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int H,W;
    cin >> H >> W;
    int x,y;
    cin >> x >> y;
    
    ve<string> s(H);
    in(H,s);
    
    x--,y--;
    int ans = 0;
    for (int i = x+1; i < H; i++) {
        if(s[i][y] == '.')ans++;
        else break;
    }
    for (int i = x-1; i >= 0; i--) {
        if(s[i][y] == '.')ans++;
        else break;
    }
    for (int i = y+1; i < W; i++) {
        if(s[x][i] == '.')ans++;
        else break;
    }
    for (int i = y-1; i >= 0; i--) {
        if(s[x][i] == '.')ans++;
        else break;
    }
    
    cout << ans+1 << endl;
    
    

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,m,x,y;
char a[105][105];
int ans;

signed main()
{
	cin>>n>>m>>x>>y;
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j)
		{
			cin>>a[i][j];
		}
	}
	if(a[x][y]=='#'){
		cout<<0<<'\n';
		return 0;
	}
	ans=1;
	for(int i=1;i<=n;++i)
	{
		if(x+i>n || a[x+i][y]=='#') break;
		ans++;
	}
	for(int i=1;i<=n;++i)
	{
		if(x-i<=0 || a[x-i][y]=='#') break;
		ans++;
	}
	for(int i=1;i<=m;++i)
	{
		if(y+i>m || a[x][y+i]=='#') break;
		ans++;
	}
	for(int i=1;i<=m;++i)
	{
		if(y-i<=0 || a[x][y-i]=='#') break;
		ans++;
	}
	cout<<ans<<'\n';
	return 0;
} 