#include <bits/stdc++.h>
using namespace std;
int N, M;
int R, C;
int X, Y;
char A[2005][2005];
int Cost[2005][2005];
bool vis[2005][2005];
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
deque<pair<int, int> > Q;
bool OK(int x, int y) {
  return x >= 1 && x <= N && y >= 1 && y <= M && vis[x][y] == false &&
         A[x][y] == '.';
}
int main() {
  cin >> N >> M;
  cin >> R >> C >> X >> Y;
  for (int i = 1; i <= N; i++) cin >> (A[i] + 1);
  Q.push_back(make_pair(R, C));
  vis[R][C] = true;
  while (!Q.empty()) {
    int i = Q.front().first;
    int j = Q.front().second;
    Q.pop_front();
    for (int k = 0; k < 4; k++) {
      int ii = i + dx[k];
      int jj = j + dy[k];
      if (OK(ii, jj)) {
        vis[ii][jj] = true;
        Cost[ii][jj] = Cost[i][j];
        if (k < 2) {
          Cost[ii][jj]++;
          Q.push_back(make_pair(ii, jj));
        } else
          Q.push_front(make_pair(ii, jj));
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      if (A[i][j] == '.' && vis[i][j]) {
        int r, l;
        l = (Cost[i][j] - (j - C)) / 2;
        r = j - C + l;
        if (l <= X && r <= Y) ans++;
      }
  cout << ans << "\n";
  return 0;
}
