#include <bits/stdc++.h>
template <class T>
bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, ro, c, x, y, ans = 0;
  char ch;
  cin >> n >> m >> ro >> c >> x >> y;
  --ro;
  --c;
  vector<vector<long long> > g(n, vector<long long>(m, 0)),
      r(n, vector<long long>(m, LLONG_MAX)),
      l(n, vector<long long>(m, LLONG_MAX));
  for (int i = 0; i < (int)n; ++i)
    for (int j = 0; j < (int)m; ++j) {
      cin >> ch;
      if (ch == '*') g[i][j] = 1;
    }
  r[ro][c] = 0;
  l[ro][c] = 0;
  queue<pair<int, int> > q;
  q.push(make_pair(ro, c));
  while (!q.empty()) {
    ro = q.front().first;
    c = q.front().second;
    q.pop();
    for (int i = (int)1; i < (int)n; ++i) {
      if (ro - i < 0 || g[ro - i][c] || r[ro - i][c] <= r[ro][c]) break;
      r[ro - i][c] = r[ro][c];
      l[ro - i][c] = l[ro][c];
      q.push(make_pair(ro - i, c));
    }
    for (int i = (int)1; i < (int)n; ++i) {
      if (ro + i >= n || g[ro + i][c] || r[ro + i][c] <= r[ro][c]) break;
      r[ro + i][c] = r[ro][c];
      l[ro + i][c] = l[ro][c];
      q.push(make_pair(ro + i, c));
    }
    if (c - 1 >= 0 && !g[ro][c - 1] && l[ro][c] + 1 <= x &&
        l[ro][c - 1] > l[ro][c] + 1) {
      r[ro][c - 1] = r[ro][c];
      l[ro][c - 1] = l[ro][c] + 1;
      q.push(make_pair(ro, c - 1));
    }
    if (c + 1 < m && !g[ro][c + 1] && r[ro][c] + 1 <= y &&
        r[ro][c + 1] > r[ro][c] + 1) {
      r[ro][c + 1] = r[ro][c] + 1;
      l[ro][c + 1] = l[ro][c];
      q.push(make_pair(ro, c + 1));
    }
  }
  for (int i = 0; i < (int)n; ++i)
    for (int j = 0; j < (int)m; ++j) {
      if (!g[i][j] && r[i][j] <= y && l[i][j] <= x) ++ans;
    }
  cout << ans << endl;
  return 0;
}
