#include <bits/stdc++.h>
static const int Infinity = 1e9;
static void add(std::vector<std::vector<int>> &v,
                std::vector<std::vector<bool>> &used,
                std::queue<std::pair<int, int>> &queue, int r, int c, int l,
                int max) {
  if (v[r][c] == Infinity || l > max) return;
  if (v[r][c] == 0 && used[r][c]) return;
  if (v[r][c] == 0 && !used[r][c]) {
    used[r][c] = true;
    queue.push({r, c});
    v[r][c] = l;
  } else if (v[r][c] != 0 && v[r][c] > l) {
    used[r][c] = true;
    queue.push({r, c});
    v[r][c] = l;
  }
}
static void bfs(std::vector<std::vector<int>> &v,
                std::vector<std::vector<bool>> &used, int n, int m, int r,
                int c, int x, int y) {
  std::queue<std::pair<int, int>> queue;
  queue.push({r, c});
  used[r][c] = true;
  while (queue.size() > 0) {
    auto p = queue.front();
    queue.pop();
    add(v, used, queue, p.first + 1, p.second, v[p.first][p.second] + 0, y);
    add(v, used, queue, p.first - 1, p.second, v[p.first][p.second] + 0, y);
    add(v, used, queue, p.first, p.second + 1, v[p.first][p.second] + 1, y);
    add(v, used, queue, p.first, p.second - 1, v[p.first][p.second] + 0, y);
  }
}
int main(int argc, const char *argv[]) {
  int n, m, r, c, x, y;
  std::cin >> n >> m >> r >> c >> x >> y;
  std::vector<std::vector<int>> v(n + 2);
  for (int i = 0; i < n + 2; i++) v[i].resize(m + 2);
  std::vector<std::vector<bool>> used(n + 2);
  for (int i = 0; i < n + 2; i++) used[i].resize(m + 2);
  for (int i = 0; i < n + 2; i++)
    for (int j = 0; j < m + 2; j++) v[i][j] = Infinity;
  for (int i = 1; i <= n; i++) {
    std::string s;
    std::cin >> s;
    for (int j = 1; j <= m; j++)
      if (s[j - 1] == '.') v[i][j] = 0;
  }
  bfs(v, used, n, m, r, c, x, y);
  int result = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int t = j - c;
      int right = v[i][j];
      int left = right - t;
      if (left <= x && right <= y && used[i][j]) result++;
    }
  }
  std::cout << result << std::endl;
  return 0;
}
