#include <bits/stdc++.h>
using namespace std;
int n, m, si, sj, X, Y;
const int N = 2e3 + 7;
char mp[N][N];
int dp[N][N];
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
struct Node {
  int i, j, x;
  Node(int i, int j, int x) : i(i), j(j), x(x) {}
};
void bfs(int si, int sj) {
  memset(dp, 125, sizeof(dp));
  queue<Node> q;
  dp[si][sj] = 0;
  q.push(Node(si, sj, 0));
  while (!q.empty()) {
    Node t = q.front();
    q.pop();
    if (t.x < dp[t.i][t.j]) continue;
    for (int k = 0; k < 4; k++) {
      int di = dir[k][0] + t.i;
      int dj = dir[k][1] + t.j;
      int xx = k == 3 ? t.x + 1 : t.x;
      if (di < 1 || di > n || dj < 1 || dj > m) continue;
      if (mp[di][dj] == '*') continue;
      if (dp[di][dj] <= xx) continue;
      dp[di][dj] = xx;
      q.push(Node(di, dj, xx));
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d%d%d%d", &si, &sj, &X, &Y);
  for (int i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
  bfs(si, sj);
  int ans = 0, len;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int len = sj - j;
      if (len > 0) {
        if (dp[i][j] > X) continue;
        if (dp[i][j] - len > Y) continue;
        ans++;
      } else {
        if (dp[i][j] > X) continue;
        if (dp[i][j] - len > Y) continue;
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
