#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 100010;
const int INF = 2147483600;
int N, M;
int Rr, C, X, Y;
char str[2001][2001];
struct data {
  int x, y, ans, nx, ny;
};
deque<data> que;
inline data make_data(int x, int y, int xx, int yy) {
  data a;
  a.x = x;
  a.y = y;
  a.nx = xx;
  a.ny = yy;
  return a;
}
bool vis[2001][2001];
int dis[5][2] = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}};
int L[2001][2001], R[2001][2001];
int main() {
  N = read(), M = read();
  Rr = read(), C = read();
  X = read(), Y = read();
  for (int i = 1; i <= N; i++) scanf("%s", str[i] + 1);
  que.push_front(make_data(Rr, C, 0, 0));
  memset(vis, 0, sizeof(vis));
  int ans = 0;
  vis[Rr][C] = 1;
  while (!que.empty()) {
    data k = que.front();
    que.pop_front();
    if (L[k.x][k.y] <= X && R[k.x][k.y] <= Y) ans++;
    for (int i = 0; i < 4; i++) {
      int xx = k.x + dis[i][0];
      int yy = k.y + dis[i][1];
      if (xx < 1 || yy < 1 || xx > N || yy > M || str[xx][yy] == '*') continue;
      int tx = k.nx, ty = k.ny;
      if (vis[xx][yy]) continue;
      vis[xx][yy] = true;
      if (i == 0) tx++;
      if (i == 1) ty++;
      L[xx][yy] = tx;
      R[xx][yy] = ty;
      if (i <= 1)
        que.push_back(make_data(xx, yy, tx, ty));
      else
        que.push_front(make_data(xx, yy, tx, ty));
    }
  }
  cout << ans << endl;
  return 0;
}
