#include<bits/stdc++.h>

using namespace std;

int main(){
  
  int H, W, X, Y;
  cin >> H >> W >> X >> Y;
  X -= 1; Y -= 1;
  
  vector<vector<bool>> S(H, vector<bool>(W));
  string S_0;
  for (int i=0; i<H; i++){
    cin >> S_0;
    for (int j=0; j<W; j++){
      if(S_0[j] == '#')
        S.at(i).at(j) = false;
      else
        S.at(i).at(j) = true;
    }
  }
  
  // result
  int result = 1;	// <- + (X, Y)'s score
  
  // up
  for (int i=X-1; i>=0; i--){
    if (S.at(i).at(Y) == 0)
        break;
    result += S.at(i).at(Y);
  }
  
  // down
  for (int i=X+1; i<H; i++){
    if (S.at(i).at(Y) == 0)
        break;
    result += S.at(i).at(Y);
  }
  
  // left
  for (int j=Y-1; j>=0; j--){
    if (S.at(X).at(j) == 0)
        break;
    result += S.at(X).at(j);
  }
  
  // right
  for (int j=Y+1; j<W; j++){
    if (S.at(X).at(j) == 0)
        break;
    result += S.at(X).at(j);
  }
  
  // result
  cout << result << endl;
  
  return 0; 
}
    #include <bits/stdc++.h>
    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;
    	std::string s[h];
    	for (auto &i : s) std::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;
    }
