#include <bits/stdc++.h>
using namespace std;
int n, m, sx, sy, l, r, ans;
char Map[2010][2010];
int signl[2010][2010], signr[2010][2010];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct Node {
  int x, y, l, r;
  bool operator<(Node a) const {
    if (l != a.l)
      return l < a.l;
    else
      return r < a.r;
  }
};
int bfs() {
  priority_queue<Node> que;
  que.push({sx, sy, l, r});
  ans = 1;
  memset(signl, -1, sizeof(signl));
  memset(signr, -1, sizeof(signr));
  signl[sx][sy] = l;
  signr[sx][sy] = r;
  while (!que.empty()) {
    Node v, tmp;
    v = que.top();
    que.pop();
    for (int i = 0; i < 4; i++) {
      if (i == 1 && v.r == 0) continue;
      if (i == 3 && v.l == 0) continue;
      tmp.x = v.x + dx[i];
      tmp.y = v.y + dy[i];
      if (tmp.x > n || tmp.x < 1 || tmp.y > m || tmp.y < 1 ||
          Map[tmp.x][tmp.y] == '*')
        continue;
      tmp.r = v.r, tmp.l = v.l;
      if (i == 1) tmp.r -= 1;
      if (i == 3) tmp.l -= 1;
      if (signl[tmp.x][tmp.y] >= tmp.l && signr[tmp.x][tmp.y] >= tmp.r)
        continue;
      if (signl[tmp.x][tmp.y] == -1) ans++;
      signl[tmp.x][tmp.y] = tmp.l, signr[tmp.x][tmp.y] = tmp.r;
      que.push(tmp);
    }
  }
  return ans;
}
int main() {
  scanf("%d%d%d%d", &n, &m, &sx, &sy);
  scanf("%d%d", &l, &r);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> Map[i][j];
  printf("%d\n", bfs());
  return 0;
}
