#include <iostream>
#include <vector>

using namespace std;

int main() {
  int H, W, X, Y;
  cin >> H >> W >> X >> Y;

  auto S = vector<string>(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }

  // for (auto&& e : S) {
  //   cout << e << " ";
  // }
  // cout << endl;

  // auto cand = vector<int>();
  // auto appear = vector<int>(N + 1, -1);

  int ans = -3;

  {
    int x = X - 1, y = Y - 1;
    while (0 <= x && x < H && 0 <= y && y < W && S[x][y] == '.') {
      ans++;
      x++;
    }
  }
  {
    int x = X - 1, y = Y - 1;
    while (0 <= x && x < H && 0 <= y && y < W && S[x][y] == '.') {
      ans++;
      x--;
    }
  }
  {
    int x = X - 1, y = Y - 1;
    while (0 <= x && x < H && 0 <= y && y < W && S[x][y] == '.') {
      ans++;
      y++;
    }
  }
  {
    int x = X - 1, y = Y - 1;
    while (0 <= x && x < H && 0 <= y && y < W && S[x][y] == '.') {
      ans++;
      y--;
    }
  }

  cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
  int H, W, X, Y;
  cin >> H >> W >> X >> Y;
  X = X-1;
  Y = Y-1; //添え字にした
  vector<vector<char>> data(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> data.at(i).at(j);
    }
  } //2元配列入れた
  
  int count = 0;
  for (int i = X; i < H; i++) {
    if(data.at(i).at(Y) == '#'){
      break;
    }
    count++;
  }
  for (int i = X; i > -1; i--) {
    if(data.at(i).at(Y) == '#'){
      break;
    }
    count++;
  }
  for (int i = Y; i < W; i++) {
    if(data.at(X).at(i) == '#'){
      break;
    }
    count++;
  }
  for (int i = Y; i > -1; i--) {
    if(data.at(X).at(i) == '#'){
      break;
    }
    count++;
  }    
  
  count = count -3;
  cout << count << endl;
  
}
