#include <iostream>
#include <vector>
#include<string>
#include <set>
#include <cstdlib>
#include <map>
#include <cmath>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <ctype.h>
using namespace std;
 
int main()
{
    int H;
    int W;
    int X;
    int Y;
    cin >> H >> W >> X >> Y;
	X--;
	Y--;
	
	vector<std::string>S(H);
	int result = 1;
	for(int i = 0;i<H;i++){
		cin >> S[i];
	}
	
	for(int i = Y + 1;i<W && S[X][i] != '#';i++){
		result++;
	}
	for(int i = Y - 1;i>=0 && S[X][i] != '#';i--){
		result++;
	}
	for(int i = X + 1;i<H && S[i][Y] != '#';i++){
		result++;
	}
	for(int i = X - 1;i>=0 && S[i][Y] != '#';i--){
		result++;
	}
	
    cout << result << endl;
	return 0;
}

#include <bits/stdc++.h>

#define rep(i, a, b) for (int i = a; i < b; i++)
#define repvec(i, v) for (int i = 0; i < v.size(); i++)
#define vecall(v) (v).begin(), (v).end()
#define input(t, ...) \
  t __VA_ARGS__;      \
  in(__VA_ARGS__)
#define invec(t, v, n) \
  vector<t> v(n);      \
  for (int index = 0; index < n; index++) cin >> v[index];
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
inline void in(void) { return; }
template <typename First, typename... Rest>
void in(First& first, Rest&... rest) {
  cin >> first;
  in(rest...);
  return;
}
inline void out(void) { return; }
template <typename First, typename... Rest>
void out(First first, Rest... rest) {
  cout << " " << first;
  out(rest...);
  return;
}
const double Pi = acos(-1);

int main() {
  input(int, h, w, x, y);
  x--;
  y--;
  int ans = 1;
  vector<vector<int>> mapp(h, vector<int>(w, 0));
  rep(i, 0, h) {
    rep(j, 0, w) {
      input(char, s);
      if (s == '#') mapp[i][j] = 1;
    }
  }
  rep(i, 1, 100){
    if(x - i < 0) break;
    else if(mapp[x - i][y] == 0) ans++;
    else break;
  }
  rep(i, 1, 100){
    if(x + i >= h) break;
    else if(mapp[x + i][y] == 0) ans++;
    else break;
  }
  rep(i, 1, 100){
    if(y - i < 0) break;
    else if(mapp[x][y - i] == 0) ans++;
    else break;
  }
  rep(i, 1, 100){
    if(y + i >= w) break;
    else if(mapp[x][y + i] == 0) ans++;
    else break;
  }
  out(ans);
}