#include <bits/stdc++.h>
int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
long long n, m;
long long xx, yy;
long long le, ri;
char a[2005][2005];
long long visl[2005][2005];
long long visr[2005][2005];
int ans = 1;
struct node {
  long long x, y, l, r;
};
using namespace std;
void bfs(long long xx, long long yy, long long n, long long m) {
  node now, k;
  queue<node> q;
  now.x = xx;
  now.y = yy;
  now.l = le;
  now.r = ri;
  q.push(now);
  memset(visl, -1, sizeof(visl));
  memset(visr, -1, sizeof(visr));
  visl[xx][yy] = le;
  visr[xx][yy] = ri;
  while (!q.empty()) {
    k = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      if (i == 1 && !k.r) continue;
      if (i == 3 && !k.l) continue;
      now.x = k.x + dir[i][0];
      now.y = k.y + dir[i][1];
      if (now.x < 1 || now.x > n || now.y < 1 || now.y > m ||
          a[now.x][now.y] == '*') {
        continue;
      }
      now.r = k.r;
      now.l = k.l;
      if (i == 1) now.r -= 1;
      if (i == 3) now.l -= 1;
      if (visl[now.x][now.y] >= now.l && visr[now.x][now.y] >= now.r) continue;
      if (visl[now.x][now.y] == -1) ans++;
      visl[now.x][now.y] = now.l;
      visr[now.x][now.y] = now.r;
      q.push(now);
    }
  }
}
int main() {
  cin >> n >> m;
  cin >> xx >> yy;
  cin >> le >> ri;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  bfs(xx, yy, n, m);
  cout << ans;
  return 0;
}
