#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,x,y,i,j,cn=0;
	char mp[101][101];
	scanf("%d%d%d%d",&h,&w,&y,&x);
	for(i=0;i<h;i++) scanf("%s",mp[i]);
	x-=1; y-=1;
	for(i=y;i<h;i++){
		if(mp[i][x]=='.') cn++;
		else break;
	}
	for(i=x;i<w;i++){
		if(mp[y][i]=='.') cn++;
		else break;
	}
	for(i=y;i>=0;i--){
		if(mp[i][x]=='.') cn++;
		else break;
	}
	for(i=x;i>=0;i--){
		if(mp[y][i]=='.') cn++;
		else break;
	}
	printf("%d\n",cn-3);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    int h,w,x,y;
    cin>>h>>w>>x>>y;
    char arr[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>arr[i][j];
        }
    }
    int ans=0;
    for(int i=y-2;i>=0;i--){
        //cout<<i<<" "<<"\n";
        //cout<<arr[x-1][i]<<"\n";
     if(arr[x-1][i]=='.'){
        // cout<<"!"<<x-1<<" "<<i<<"\n";
         ans++;
         //cout<<"###"<<"\n";
     }
     else break;
    }
     for(int i=y;i<w;i++){
     if(arr[x-1][i]=='.'){
         //cout<<"!!"<<x-1<<" "<<i<<"\n";
         ans++;
     }
     else break;
    }
    for(int i=x-2;i>=0;i--){
     if(arr[i][y-1]=='.'){
         //cout<<"!!"<<i<<" "<<y-1<<"\n";
         ans++;
     }
     else break;
    }
    for(int i=x;i<h;i++){
     if(arr[i][y-1]=='.'){
        // cout<<"!!!!"<<i<<" "<<y-1<<"\n";
         ans++;
     }
     else break;
    }
    if(arr[x-1][y-1]=='.'){
       // cout<<"#"<<ans<<"\n";
        ans++;
    }
    if(arr[x-1][y-1]!='.'){
        ans=0;
    }
    cout<<ans;
	return 0;
}