#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int h, w, x, y;
	cin >> h >> w >> x >> y;
	string s[101];
	for (int i = 1; i <= h; i++)
		cin >> s[i];
	int sum = 0;
	for (int i = y - 1; i >= 0; i--) {
		if (s[x][i] == '.')
			sum++;
		else break;
	}
	for (int i = y; i < w; i++) {
		if (s[x][i] == '.')
			sum++;
		else break;
	}
	for (int i = x - 1; i > 0; i--) {
		if (s[i][y - 1] == '.')
			sum++;
		else break;
	}
	for (int i = x + 1; i <= h; i++) {
		if (s[i][y - 1] == '.')
			sum++;
		else break;
	}
	cout << sum << endl;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P =pair<int,int>;

int main (){
  int H,W,X,Y,count=0;
  cin >>H>>W>>X>>Y;
  vector<vector<char>> det(H,vector<char>(W));
  rep(i,H){
    rep(j,W){
      cin >>det.at(i).at(j);
    }
  }
  
  if(det.at(X-1).at(Y-1)=='#'){
    cout <<0;
    return 0;
  }
  count++;
  for(int i=1;;i++){
    if(X-1-i<0)
      break;
    if(det.at(X-1-i).at(Y-1)=='#')
      break;
    count++;    
  }
  for(int i=1;;i++){
    if(Y-1-i<0)
      break;
    if(det.at(X-1).at(Y-1-i)=='#')
      break;
    count++;    
  }
  
  for(int i=1;;i++){
    if(X-1+i>H-1)
      break;
    if(det.at(X-1+i).at(Y-1)=='#')
      break;
    count++;    
  }
  for(int i=1;;i++){
    if(Y-1+i>W-1)
      break;
    if(det.at(X-1).at(Y-1+i)=='#')
      break;
    count++;    
  }
  
  cout<<count;
  
  
}