#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e3 + 100;
const int b[4][2] = {0, 1, 0, -1, 1, 0, -1, 0};
int n, m, st, ed, x, y;
char maze[N][N];
bool vis[N][N];
struct Node {
  int x, y, l, r;
};
int bfs() {
  int ans = 0;
  deque<Node> q;
  q.push_back({st, ed, 0, 0});
  vis[st][ed] = true;
  while (q.size()) {
    Node cur = q.front();
    q.pop_front();
    if (cur.l <= x && cur.r <= y) ans++;
    for (int i = 0; i < 4; i++) {
      int xx = cur.x + b[i][0];
      int yy = cur.y + b[i][1];
      if (xx <= 0 || yy <= 0 || xx > n || yy > m) continue;
      if (vis[xx][yy]) continue;
      if (maze[xx][yy] == '*') continue;
      vis[xx][yy] = true;
      if (i < 2)
        q.push_back({xx, yy, cur.l + (i == 1), cur.r + (i == 0)});
      else
        q.push_front({xx, yy, cur.l + (i == 1), cur.r + (i == 0)});
    }
  }
  return ans;
}
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &st, &ed, &x, &y);
  for (int i = 1; i <= n; i++) scanf("%s", maze[i] + 1);
  printf("%d\n", bfs());
  return 0;
}
