#include <bits/stdc++.h>
using namespace std;
ifstream inp("inp.txt");
ofstream out("out.txt");
const int INF = 1e9 + 7;
struct edge {
  int v;
  bool w;
  bool t;
};
signed main() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, r, c, x, y;
  cin >> n >> m >> r >> c >> x >> y;
  vector<vector<bool>> a(n, vector<bool>(m, 1));
  for (int i = 0; i < n; i++) {
    string tt;
    cin >> tt;
    for (int j = 0; j < m; j++)
      if (tt[j] == '*') a[i][j] = 0;
  }
  vector<vector<edge>> g(n * m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!a[i][j]) continue;
      if (i > 0 && a[i - 1][j]) g[i * m + j].push_back({(i - 1) * m + j, 0, 0});
      if (i < n - 1 && a[i + 1][j])
        g[i * m + j].push_back({(i + 1) * m + j, 0, 0});
      if (j > 0 && a[i][j - 1]) g[i * m + j].push_back({i * m + j - 1, 1, 0});
      if (j < m - 1 && a[i][j + 1])
        g[i * m + j].push_back({i * m + j + 1, 1, 1});
    }
  }
  int st = (r - 1) * m + c - 1;
  deque<int> q(1, st);
  vector<int> dp1(n * m, INF);
  vector<int> dp2(n * m, INF);
  vector<int> dist(n * m, INF);
  vector<bool> used(n * m, 0);
  dp1[st] = dp2[st] = dist[st] = 0;
  while (!q.empty()) {
    int u = q.front();
    used[u] = 1;
    q.pop_front();
    for (auto &el : g[u]) {
      int v = el.v;
      int w = el.w;
      int t = el.t;
      if (dist[v] != INF) continue;
      if (w) {
        if (dist[u] + 1 < dist[v]) {
          if (t) {
            if (dp2[u] + 1 <= y) {
              dp2[v] = dp2[u] + 1;
              dist[v] = dist[u] + 1;
              dp1[v] = dp1[u];
              q.push_back(v);
            }
          } else {
            if (dp1[u] + 1 <= x) {
              dp1[v] = dp1[u] + 1;
              dist[v] = dist[u] + 1;
              dp2[v] = dp2[u];
              q.push_back(v);
            }
          }
        }
      } else {
        if (dist[u] < dist[v]) {
          dist[v] = dist[u];
          dp1[v] = dp1[u];
          dp2[v] = dp2[u];
          q.push_front(v);
        }
      }
    }
  }
  int ans = 0;
  for (auto el : used) ans += int(el);
  cout << ans;
  return 0;
}
