#include <iostream>
using namespace std;



int main() 
{
	int a,b,x,y,i,j,sum=1;
	cin>>a>>b>>x>>y;
	char str[a+1][b+1];
	for(i=0;i<a;i++)
	{
		cin>>str[i];
	}
	i=x-1,j=y-1;
	for(i=x;i<a;i++)
	{
		if(str[i][j]=='.')
		{
			sum++;
		}
		if(str[i][j]=='#')
		break;
	}
	for(i=x-1,j=y;j<b;j++)
	{
		if(str[i][j]=='.')
		{
			sum++;
		}
		if(str[i][j]=='#')
		break;
	}
	for(i=x-1,j=y-2;j>=0;j--)
	{
		if(str[i][j]=='.')
		{
			sum++;
		}
		if(str[i][j]=='#')
		break;
	}
	for(i=x-2,j=y-1;i>=0;i--)
	{
		if(str[i][j]=='.')
		{
			sum++;
		}
		if(str[i][j]=='#')
		break;
	}
	cout<<sum;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<vector<vector<long double> > > vvvld;
typedef vector<vector<long double> > vvld;
typedef vector<vector<vector<int> > > vvvi;
typedef vector<vector<int> > vvi;
#define rep(i,n) for (int  i = 0; i< (int)(n); i++)
int kazu(int x, string s){
  int ans =0;
  int now = 0;
  bool y = false;
  rep(i,s.size()){
    if(s.at(i)=='.') now++;
    if(s.at(i)=='#'){
      if(y){
        y = false;
        ans = now;
        break;
      }
      else{
        now = 0;
      }
    }
    if(i == x && s.at(i) != '#') y = true;
  }
  if(y) ans = now;
  return ans;
}
int main(){
  int h,w,x,y;
  cin>>h>>w>>x>>y;
  vector<string> s(h);
  rep(i,h) cin>>s.at(i);
  string tate;
  rep(i,h){
    tate += s.at(i).at(y-1);
  }
  int ans=kazu(y-1,s.at(x-1)) + kazu(x-1, tate);
  if(ans>0) ans--;
  cout<<ans<<endl;
  //cout << fixed;
  //cout << setprecision(10)<< << endl;
}
