#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
inline long long read() {
  bool flag = 1;
  long long x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') flag = 0;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return (flag ? x : ~(x - 1));
}
long long n, m, x, y, a, b, ans, mp[2001][2001], dis[2001][2001];
deque<pair<long long, long long> > deq;
long long px[] = {0, 1, 0, -1};
long long py[] = {1, 0, -1, 0};
bool ok(long long x, long long y) { return (x && y && x <= n && y <= m); }
signed main() {
  n = read();
  m = read();
  x = read();
  y = read();
  a = read();
  b = read();
  for (long long i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (long long l = 0; l < m; l++)
      if (s[l] == '*') mp[i][l + 1] = 1;
  }
  for (long long i = 1; i <= n; i++)
    for (long long l = 1; l <= m; l++) dis[i][l] = 114514114514114514;
  dis[x][y] = 0;
  deq.push_back({x, y});
  while (!deq.empty()) {
    pair<long long, long long> p = deq.front();
    long long xx = p.first, yy = p.second;
    deq.pop_front();
    for (long long i = 0; i < 4; i++)
      if (ok(xx + px[i], yy + py[i]))
        if (!mp[xx + px[i]][yy + py[i]]) {
          if (i) {
            if (dis[xx + px[i]][yy + py[i]] > dis[xx][yy]) {
              dis[xx + px[i]][yy + py[i]] = dis[xx][yy];
              deq.push_front({xx + px[i], yy + py[i]});
            }
          } else if (dis[xx + px[i]][yy + py[i]] > dis[xx][yy] + 1) {
            dis[xx + px[i]][yy + py[i]] = dis[xx][yy] + 1;
            deq.push_back({xx + px[i], yy + py[i]});
          }
        }
  }
  for (long long i = 1; i <= n; i++)
    for (long long l = 1; l <= m; l++)
      if (dis[i][l] != 114514114514114514) {
        long long right = dis[i][l];
        long long left = right + y - l;
        if (left <= a && right <= b) ans++;
      }
  cout << ans;
  return 0;
}
