#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int main()
{

	int h, w, x, y, c = 0;
	cin >> h >> w >> x >> y;
	x--;
	y--;
	string *a = new string[h];
	for (int i = 0; i < h; i++)
		cin >> a[i];

	if (a[x][y] == '.')
		c++;
	for (int j = x - 1; j >= 0; j--)
		if (a[j][y] == '.')
			c++;
		else
			break;
		for (int j = x + 1; j <= h - 1; j++)
			if (a[j][y] == '.')
				c++;
			else
				break;
		for (int j = y - 1; j >= 0; j--)
			if (a[x][j] == '.')
				c++;
			else
				break;
		for (int j = y + 1; j <= w-1; j++)
			if (a[x][j] == '.')
				c++;
			else
				break;
		cout << c;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
  int H, W, X, Y;
  cin >> H >> W >> X >> Y;
  vector<vector<char>> mas(H, vector<char>(W));
  for (int i=0;i<H;i++) {
    for (int j=0;j<W;j++) {
      cin >> mas.at(i).at(j);
    }
  }
  int ans = 0;
  for (int i=0;;i++) {
    if (X-1<0 || Y-1+i>=W) break;
    if (mas[X-1][Y-1+i]=='.') {
      ans++;
    } else {
      break;
    }
  }
  for (int i=0;;i++) {
    if (X-1<0 || Y-1-i<0) break;
    if (mas[X-1][Y-1-i]=='.') {
      if (i==0){
        continue;
      } else {
        ans++;
      }
    } else {
      break;
    }
  }
  for (int i=0;;i++) {
    if (X-1+i>=H || Y-1<0) break;
    if (mas[X-1+i][Y-1]=='.') {
      if (i==0){
        continue;
      } else {
        ans++;
      }
    } else {
      break;
    }
  }
  for (int i=0;;i++) {
    if (X-1-i<0 || Y-1<0) break;
    if (mas[X-1-i][Y-1]=='.') {
      if (i==0){
        continue;
      } else {
        ans++;
      }
    } else {
      break;
    }
  }
  cout << ans << endl;
}