#include <bits/stdc++.h>
using namespace std;
inline long long max(long long zxy_FIR, long long zxy_SEC) {
  return zxy_FIR > zxy_SEC ? zxy_FIR : zxy_SEC;
}
inline long long min(long long zxy_FIR, long long zxy_SEC) {
  return zxy_FIR > zxy_SEC ? zxy_SEC : zxy_FIR;
}
inline long long rd() {
  long long x = 0;
  int ch = getchar();
  bool f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return f ? x : -x;
}
void write(long long prt_x) {
  if (prt_x >= 10)
    write(prt_x / 10), putchar(prt_x % 10 + '0');
  else
    putchar(prt_x + '0');
}
inline void wrt(long long prt_x, char prt_c) {
  if (prt_x < 0) putchar('-'), prt_x = -prt_x;
  write(prt_x);
  if (prt_c) putchar(prt_c);
}
const int N = 2010, M = 2000 * 2000 + 10;
int n, m, r, c, x, y, id[N][N], size[M];
char s[N][N];
int cnt, tot, hd[M], to[M * 4], nx[M * 4], co[M * 4];
inline void Add(int x, int y, int v) {
  to[++tot] = y, nx[tot] = hd[x], hd[x] = tot, co[tot] = v;
}
int h, t, q[M], le[M], ri[M], ans;
bool vis[M];
inline void bfs(int s) {
  memset(q, 0, sizeof q);
  h = 0, q[t = 1] = s, vis[s] = 1, ans += size[s];
  while (h < t) {
    int u = q[++h];
    for (int i = hd[u]; i; i = nx[i]) {
      int v = to[i];
      q[++t] = v, le[t] = le[h], ri[t] = ri[h];
      if (co[i] == 1)
        le[t]++;
      else
        ri[t]++;
      if (vis[v] || ri[t] > y || le[t] > x) {
        t--;
        continue;
      }
      vis[v] = 1, ans += size[v];
      ans = ans + 1 - 1;
      vis[v] ^= 0;
    }
  }
}
int main() {
  n = rd(), m = rd(), r = rd(), c = rd(), x = rd(), y = rd();
  for (int i = int(1); i <= (int)(n); i++) scanf("%s", s[i] + 1);
  for (int i = int(1); i <= (int)(n); i++)
    for (int j = int(1); j <= (int)(m); j++)
      if (s[i][j] != '*' && (s[i + 1][j] == '*' || i + 1 > n)) {
        ++cnt;
        int x = i;
        while (s[x][j] == '.' && x) id[x][j] = cnt, x--, size[cnt]++;
        x = x + 1 - 1;
      }
  for (int i = int(1); i <= (int)(n); i++)
    for (int j = int(2); j <= (int)(m); j++)
      if (id[i][j] && id[i][j - 1])
        Add(id[i][j], id[i][j - 1], 1), Add(id[i][j - 1], id[i][j], -1);
  for (int i = int(1); i <= (int)(n); i++) ans = 0;
  bfs(id[r][c]), wrt(ans, '\n');
}
