#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 7;
int cnt;
int n, m;
int r, c;
int x, y;
char a[N][N];
int used[N][N];
int dx[]{-1, 1, 0, 0};
int dy[]{0, 0, -1, 1};
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> r >> c >> x >> y;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  deque<pair<int, int>> q = {{r, c}};
  vector<vector<int>> d(n + 1, vector<int>(m + 1, 1e9));
  d[r][c] = 0;
  while (!q.empty()) {
    pair<int, int> v = q.front();
    q.pop_front();
    if (used[v.first][v.second] == 1) continue;
    used[v.first][v.second] = 1;
    for (int i = 0; i < 4; i++) {
      int nr = v.first + dx[i];
      int nc = v.second + dy[i];
      if (nr <= 0 || nr > n) continue;
      if (nc <= 0 || nc > m) continue;
      if (a[nr][nc] == '*') continue;
      if (d[nr][nc] > d[v.first][v.second] + (i == 2)) {
        d[nr][nc] = d[v.first][v.second] + (i == 2);
        if (i == 2) {
          q.push_back({nr, nc});
        } else {
          q.push_front({nr, nc});
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (d[i][j] > 1e8) continue;
      int left = d[i][j];
      int right = j - (c - left);
      cnt += (left <= x && right <= y);
    }
  }
  cout << cnt << "\n";
}
