#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 5001;
long long int powxy(long long int x, long long int y) {
  if (y == 0) return 1;
  if (y % 2 == 1) return (x * powxy(x, y - 1)) % mod;
  long long int t = powxy(x, y / 2) % mod;
  return (t * t) % mod;
}
int n, m, sx, sy, l, r;
char a[2001][2001];
int vis[2001][2001];
struct node {
  int reml, remr, x, y;
  node(int xx, int yy, int l, int r) {
    x = xx;
    y = yy;
    reml = l;
    remr = r;
  }
};
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
long long int ans = 0;
void bfs() {
  deque<node> q;
  q.push_front(node(sx, sy, l, r));
  while (!q.empty()) {
    node p = q.front();
    q.pop_front();
    int x = p.x;
    int y = p.y;
    if (vis[x][y]) continue;
    vis[x][y] = 1;
    for (int i = 0; i < 4; i++) {
      int X = x + dx[i];
      int Y = y + dy[i];
      int lx = p.reml;
      int ly = p.remr;
      if (X < 1 || X > n || Y < 1 || Y > m || a[X][Y] == '*') continue;
      if (i == 0) ly--;
      if (i == 1) lx--;
      if (lx < 0 || ly < 0) continue;
      if (i <= 1)
        q.push_back(node(X, Y, lx, ly));
      else
        q.push_front(node(X, Y, lx, ly));
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> sx >> sy >> l >> r;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  bfs();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) ans += vis[i][j];
  cout << ans;
}
