#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
int n, m, sx, sy, X, Y;
int ma[maxn][maxn];
char c[maxn];
struct node {
  int x, y;
};
int dx[] = {0, -1, 1, 0, 0};
int dy[] = {0, 0, 0, 1, -1};
deque<node> Q;
int dis[maxn][maxn];
void bfs() {
  memset(dis, -1, sizeof dis);
  Q.push_front(node{sx, sy});
  dis[sx][sy] = 0;
  while (!Q.empty()) {
    node t = Q.front();
    Q.pop_front();
    for (int i = 1; i <= 4; ++i) {
      int x = t.x + dx[i], y = t.y + dy[i];
      if (x < 1 || x > n || y < 1 || y > m || ma[x][y]) continue;
      if (dis[x][y] != -1 && dis[x][y] <= dis[t.x][t.y] + (i == 4)) continue;
      dis[x][y] = dis[t.x][t.y] + (i == 4);
      if (i == 4)
        Q.push_back(node{x, y});
      else
        Q.push_front(node{x, y});
    }
  }
}
int ans;
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &X, &Y);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", c + 1);
    for (int j = 1; j <= m; ++j)
      if (c[j] == '*') ma[i][j] = 1;
  }
  bfs();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (dis[i][j] == -1) continue;
      int a = dis[i][j], b = j - sy + a;
      if (a <= X && b <= Y) ++ans;
    }
  cout << ans;
  return 0;
}
