#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
const int inf = 1e9 + 7;
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};
void solve(int test) {
  int n, m, r, c, first, second;
  cin >> n >> m >> r >> c >> first >> second;
  r--, c--;
  vector<string> g(n);
  vector<vi> d(n, vi(m, inf));
  for (int i = 0; i < n; i++) {
    cin >> g[i];
  }
  deque<pii> q;
  q.push_back(make_pair(r, c));
  d[r][c] = 0;
  while (!q.empty()) {
    pii v = q.front();
    q.pop_front();
    for (int i = 0; i < 4; i++) {
      auto u = v;
      u.first += dx[i], u.second += dy[i];
      if (u.first < 0 || u.first >= n) continue;
      if (u.second < 0 || u.second >= m) continue;
      if (g[u.first][u.second] == '*') continue;
      int w = (dy[i] == -1);
      if (d[u.first][u.second] > d[v.first][v.second] + w) {
        d[u.first][u.second] = d[v.first][v.second] + w;
        if (w == 1)
          q.push_back(u);
        else
          q.push_front(u);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int l = d[i][j];
      int r = l + j - c;
      if (l <= first && r <= second) ans++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve(i);
    cout << '\n';
  }
}
