#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int nax = 2e3 + 20;
int dr[] = {1, -1, 0, 0, 1, -1, -1, 1};
int dc[] = {0, 0, 1, -1, 1, 1, -1, -1};
int n, m;
bool check(int i, int j) { return i >= 1 && i <= n && j >= 1 && j <= m; }
vector<pair<int, int>> llega[nax][nax];
char grid[nax][nax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  int r, c;
  cin >> r >> c;
  int ml, mr;
  cin >> ml >> mr;
  for (int i = 1; i <= (int)n; ++i) {
    for (int j = 1; j <= (int)m; ++j) {
      cin >> grid[i][j];
    }
  }
  queue<tuple<int, int, int, int>> q;
  llega[r][c].push_back({ml, mr});
  q.push({r, c, ml, mr});
  int x, y;
  int ans = 1;
  while (((int)q.size())) {
    tie(x, y, ml, mr) = q.front();
    q.pop();
    for (int k = 0; k < (int)4; ++k) {
      int nx = x + dr[k];
      int ny = y + dc[k];
      if (!check(nx, ny) || grid[nx][ny] == '*') continue;
      bool f = (((int)llega[nx][ny].size()) == 0);
      bool rep = false;
      int nml = ml - (k == 3);
      int nmr = mr - (k == 2);
      for (pair<int, int> &e : llega[nx][ny]) {
        if (nml > e.first || nmr > e.second) {
          f = true;
        }
        if (nml >= e.first && nmr >= e.second) {
          e = {nml, nmr};
          rep = true;
        }
      }
      if (f && min(nml, nmr) >= 0) {
        if (!rep) llega[nx][ny].push_back({nml, nmr});
        q.push({nx, ny, nml, nmr});
        if (((int)llega[nx][ny].size()) == 1 && !rep) ++ans;
      }
    }
  }
  cout << ans << '\n';
}
