#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long xi[4] = {1, -1, 0, 0};
long long yi[4] = {0, 0, 1, -1};
char t[2001][2001];
bool vis[2001][2001];
long long xx[2001][2001];
long long yy[2001][2001];
long long x, y;
bool valid1(long long a, long long b) {
  return (a >= 0 && a < n && b >= 0 && b < m);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(vis, 0, sizeof vis);
  memset(xx, -1, sizeof xx);
  memset(yy, -1, sizeof yy);
  cin >> n >> m;
  long long r, c;
  cin >> r >> c;
  r--;
  c--;
  cin >> x >> y;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cin >> t[i][j];
  }
  queue<pair<long long, long long> > q;
  q.push({r, c});
  xx[r][c] = x;
  yy[r][c] = y;
  while (!q.empty()) {
    long long curx = q.front().first;
    long long cury = q.front().second;
    q.pop();
    if (xx[curx][cury] >= 0 && yy[curx][cury] >= 0)
      vis[curx][cury] = true;
    else
      continue;
    for (long long i = 0; i < 4; i++) {
      long long cx = curx + xi[i];
      long long cy = cury + yi[i];
      if (i == 2) {
        if (valid1(cx, cy) && t[cx][cy] != '*' && yy[curx][cury] - 1 >= 0 &&
            (xx[curx][cury] > xx[cx][cy] || yy[curx][cury] - 1 > yy[cx][cy])) {
          xx[cx][cy] = max(xx[curx][cury], xx[cx][cy]);
          yy[cx][cy] = max(yy[curx][cury] - 1, yy[cx][cy]);
          q.push({cx, cy});
        }
      } else if (i == 3) {
        if (valid1(cx, cy) && t[cx][cy] != '*' && xx[curx][cury] - 1 >= 0 &&
            (xx[curx][cury] - 1 > xx[cx][cy] || yy[curx][cury] > yy[cx][cy])) {
          xx[cx][cy] = max(xx[curx][cury] - 1, xx[cx][cy]);
          yy[cx][cy] = max(yy[curx][cury], yy[cx][cy]);
          q.push({cx, cy});
        }
      } else {
        if (valid1(cx, cy) && t[cx][cy] != '*' &&
            (xx[curx][cury] > xx[cx][cy] || yy[curx][cury] > yy[cx][cy])) {
          xx[cx][cy] = max(xx[curx][cury], xx[cx][cy]);
          yy[cx][cy] = max(yy[curx][cury], yy[cx][cy]);
          q.push({cx, cy});
        }
      }
    }
  }
  long long res = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++)
      if (vis[i][j]) res++;
  }
  cout << res;
}
