#include <bits/stdc++.h>
int n, m, l, r;
int cnt;
char maze[2005][2005];
using namespace std;
const int way[4][2] = {0, -1, 0, 1, 1, 0, -1, 0};
int dis[2005][2005];
struct Node {
  int x, y, l, r;
} start;
bool check(Node u) {
  if (u.x < 1 || u.x > n || u.y < 1 || u.y > m || maze[u.x][u.y] == '*' ||
      u.l < 0 || u.r < 0)
    return false;
  return true;
}
void BFS() {
  queue<Node> Q;
  Node u, tmp;
  u.x = start.x;
  u.y = start.y;
  u.r = r;
  u.l = l;
  dis[u.x][u.y] = l + r;
  Q.push(u);
  while (!Q.empty()) {
    u = Q.front();
    Q.pop();
    for (int i = 0; i < 4; i++) {
      tmp.x = u.x + way[i][0];
      tmp.y = u.y + way[i][1];
      tmp.l = u.l - (i == 0);
      tmp.r = u.r - (i == 1);
      int five = tmp.l + tmp.r;
      if (check(tmp)) {
        if (five > dis[tmp.x][tmp.y]) {
          Q.push(tmp);
          if (dis[tmp.x][tmp.y] == -1) cnt++;
          dis[tmp.x][tmp.y] = five;
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &start.x, &start.y, &l, &r);
  for (int i = 1; i <= n; i++) {
    scanf("%s", maze[i] + 1);
    for (int j = 1; j <= m; j++) dis[i][j] = -1;
  }
  cnt = 1;
  BFS();
  printf("%d\n", cnt);
  return 0;
}
