#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, m, r, c, x, y;
char grid[N][N];
pair<int, int> dist[N][N];
bool checkBad(int i, int j, int x, int y) {
  return !i || !j || i > n || j > m || x < 0 || y < 0 || grid[i][j] == '*' ||
         dist[i][j] >= pair<int, int>(x, y);
}
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &r, &c, &x, &y);
  for (int(i) = (1); (i) <= (int)(n); (i)++) scanf("%s", grid[i] + 1);
  priority_queue<pair<pair<int, int>, pair<int, int> > > q;
  q.push({{x, y}, {r, c}});
  for (int(i) = (1); (i) <= (int)(n); (i)++)
    for (int(j) = (1); (j) <= (int)(m); (j)++)
      dist[i][j] = {-1000000107, -1000000107};
  int ans = 0;
  dist[r][c] = {x, y};
  while (!q.empty()) {
    int x = q.top().first.first, y = q.top().first.second;
    int i = q.top().second.first, j = q.top().second.second;
    q.pop();
    if (!i || !j || i > n || j > m || x < 0 || y < 0 || grid[i][j] == '*')
      continue;
    ++ans;
    if (!checkBad(i + 1, j, x, y))
      q.push({{x, y}, {i + 1, j}}), dist[i + 1][j] = pair<int, int>(x, y);
    if (!checkBad(i - 1, j, x, y))
      q.push({{x, y}, {i - 1, j}}), dist[i - 1][j] = pair<int, int>(x, y);
    if (!checkBad(i, j + 1, x, y - 1))
      q.push({{x, y - 1}, {i, j + 1}}),
          dist[i][j + 1] = pair<int, int>(x, y - 1);
    if (!checkBad(i, j - 1, x - 1, y))
      q.push({{x - 1, y}, {i, j - 1}}),
          dist[i][j - 1] = pair<int, int>(x - 1, y);
  }
  printf("%d\n", ans);
  return 0;
}
