#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
char grid[2222][2222];
pii d[2222][2222];
int v[2222][2222];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int r, c;
  scanf("%d %d", &r, &c);
  int x, y;
  scanf("%d %d", &x, &y);
  for (int i = 0; i < n; i++) scanf("%s", grid[i]);
  r--;
  c--;
  memset(v, -1, sizeof(v));
  v[r][c] = 0;
  d[r][c] = {0, 0};
  struct state {
    int x, y, ql, qr;
  };
  struct cmp {
    bool operator()(const state a, const state b) const {
      if (a.ql != b.ql) return a.ql < b.ql;
      return a.qr < b.qr;
    }
  };
  multiset<state, cmp> mt;
  mt.insert({r, c, 0, 0});
  while (!mt.empty()) {
    state fu = *mt.begin();
    mt.erase(mt.begin());
    int mx = fu.x;
    int my = fu.y;
    for (int dx : {-1, 0, 1}) {
      for (int dy : {-1, 0, 1}) {
        if (abs(dx) + abs(dy) == 1) {
          pii add = d[mx][my];
          if (dy == -1)
            add.first++;
          else if (dy == 1)
            add.second++;
          int nmx = mx + dx, nmy = my + dy;
          if (nmx >= 0 && nmx < n && nmy >= 0 && nmy < m) {
            if (grid[nmx][nmy] == '*') {
              continue;
            }
            if (v[nmx][nmy] == -1) {
              v[nmx][nmy] = 0;
              d[nmx][nmy] = add;
              mt.insert({nmx, nmy, add.first, add.second});
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == '*') continue;
      if (v[i][j] == -1) continue;
      if (d[i][j].first <= x && d[i][j].second <= y) {
        ans++;
      }
    }
  cout << ans << endl;
  return 0;
}
