#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 + 99);
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T mpow(T a, T n) {
  T res = 1;
  for (; n; n >>= 1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}
signed main() {
  ll n, m, ans = 1;
  cin >> n >> m;
  ll r, c;
  cin >> r >> c;
  r--;
  c--;
  ll llim, rlim;
  cin >> llim >> rlim;
  vector<vector<char>> v(n, vector<char>(m));
  vector<vector<bool>> used(n, vector<bool>(m, false));
  for (ll i = 0; i < (ll)(n); i++)
    for (ll j = 0; j < (ll)(m); j++) {
      cin >> v[i][j];
    }
  deque<ll> q;
  q.push_front(rlim);
  q.push_front(llim);
  q.push_front(c);
  q.push_front(r);
  used[r][c] = true;
  while (!q.empty()) {
    ll nowt = q.front();
    q.pop_front();
    ll nowy = q.front();
    q.pop_front();
    ll L = q.front();
    q.pop_front();
    ll R = q.front();
    q.pop_front();
    for (ll i = 0; i < (ll)(4); i++) {
      ll nextt = nowt + dx[i], nexty = nowy + dy[i];
      ll nL = L, nR = R;
      if (dy[i] == 1)
        nR--;
      else if (dy[i] == -1)
        nL--;
      if (nR < 0 || nL < 0) continue;
      if (0 <= nexty && nexty < m && 0 <= nextt && nextt < n &&
          !used[nextt][nexty] && v[nextt][nexty] != '*') {
        used[nextt][nexty] = true;
        if (dy[i] != 0) {
          q.push_back(nextt);
          q.push_back(nexty);
          q.push_back(nL);
          q.push_back(nR);
        } else {
          q.push_front(nR);
          q.push_front(nL);
          q.push_front(nexty);
          q.push_front(nextt);
        }
        ans++;
      }
    }
  }
  cout << ans << endl;
}
