#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const int INF = 0x3f3f3f3f;
const int N = 2e3 + 10, mod = 1e9 + 7;
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int vis[N][N];
char Map[N][N];
struct node {
  int x, y;
} dis[N][N];
deque<node> Q;
inline int read() {
  int x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') flag = -1, ch = getchar();
  while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch - '0'), ch = getchar();
  return x * flag;
}
int main() {
  int n = read(), m = read(), X = read(), Y = read(), L = read(), R = read();
  for (int i = (1), iend = (n); i <= iend; i++) scanf("%s", Map[i] + 1);
  int cnt = 1;
  Q.push_back((node){X, Y}), vis[X][Y] = true;
  while (!Q.empty()) {
    node cur = Q.front();
    Q.pop_front();
    int x = cur.x, y = cur.y;
    for (int i = (0), iend = (3); i <= iend; i++) {
      int Nx = x + dir[i][0], Ny = y + dir[i][1], curdL = dis[x][y].x,
          curdR = dis[x][y].y;
      if (Nx <= 0 || Ny <= 0 || Nx > n || Ny > m || vis[Nx][Ny] ||
          Map[Nx][Ny] == '*')
        continue;
      if (i == 2) curdR++;
      if (i == 3) curdL++;
      if (curdL > L || curdR > R) continue;
      if (i == 2 || i == 3)
        Q.push_back((node){Nx, Ny});
      else
        Q.push_front((node){Nx, Ny});
      dis[Nx][Ny] = (node){curdL, curdR};
      vis[Nx][Ny] = true, cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
