#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 100; int n, m, x, y;
char mat[maxN][maxN + 1];

int di[4] = {0, 0, -1, 1}, dj[4] = {1, -1, 0, 0};
int main()
{
  while (~scanf("%d %d %d %d", &n, &m, &x, &y))
  {
    x--, y--;
    for (int i = 0; i < n; i++)
      scanf(" %s", mat[i]);

    int ans = -3;
    for (int k = 0; k < 4; k++)
    {
      int i = x, j = y;
      while (i >= 0 && i < n && j >= 0 && j < m && mat[i][j] == '.')
      {
        i += di[k], j += dj[k];
        ans++;
      }
    }
    ans = max(ans, 0);

    printf("%d\n", ans);
  }
  return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main() {
  int h, w, x, y, cnt = 1;
  cin >> h >> w >> x >> y;
  vector<string> s(h);
  for (int i = 0; i < h; i++) cin >> s.at(i);

  for (int i = 1; i < 100; i++) {
    if (x - 1 + i >= h) {
      break;
    }
    if (s.at(x - 1 + i).at(y - 1) == '.')
      cnt++;
    else
      break;
  }
  for (int i = 1; i < 100; i++) {
    if (x - 1 - i < 0) {
      break;
    }
    if (s.at(x - 1 - i).at(y - 1) == '.')
      cnt++;
    else
      break;
  }
  for (int i = 1; i < 100; i++) {
    if (y - 1 + i >= w) {
      break;
    }
    if (s.at(x - 1).at(y - 1 + i) == '.')
      cnt++;
    else
      break;
  }
  for (int i = 1; i < 100; i++) {
    if (y - 1 - i < 0) {
      break;
    }
    if (s.at(x - 1).at(y - 1 - i) == '.')
      cnt++;
    else
      break;
  }
  cout << cnt << endl;
}