#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int ri(){
  int n; 
  scanf("%d", &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++;
  printf("%d\n", cnt);
  return 0;
}
  
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,x,y;cin>>h>>w>>x>>y;
  --x,--y;
  vector<string> s(h);
  int ans=1;
  for(int i=0;i<h;i++)cin>>s[i];
  const int dx[]={-1,1,0,0};
  const int dy[]={0,0,-1,1};
  for(int i=0;i<4;i++){
    for(int j=1;j<200;j++){
      int nx=x+dx[i]*j,ny=y+dy[i]*j;
      if(nx<0 or nx>h-1 or ny<0 or ny>w-1)break;
      if(s[nx][ny]=='#')break;
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}