#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
const long long M = 1e7;
const long long mod = 998244353;
const long long INF = 1e18;
const long long inf = -1e18;
bool isprime(long long x) {
  long long y = sqrt(x);
  for (int i = 2; i <= y; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
int n, m, r, c;
long long x, y, ans;
char a[2007][2007];
int us[2007][2007];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> n >> m;
  cin >> r >> c;
  cin >> x >> y;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  deque<pair<long long, pair<long long, pair<long long, long long> > > > dk;
  dk.push_back({r, {c, {0, 0}}});
  while (!dk.empty()) {
    int vr = dk[0].first;
    int vc = dk[0].second.first;
    int lx = dk[0].second.second.first;
    int rx = dk[0].second.second.second;
    dk.pop_front();
    if (us[vr][vc] == 1) {
      continue;
    }
    us[vr][vc] = 1;
    ans++;
    if (vr - 1 > 0 && a[vr - 1][vc] != '*') {
      dk.push_front({vr - 1, {vc, {lx, rx}}});
    }
    if (vr + 1 <= n && a[vr + 1][vc] != '*') {
      dk.push_front({vr + 1, {vc, {lx, rx}}});
    }
    if (lx < x) {
      if (vc - 1 > 0 && a[vr][vc - 1] != '*') {
        dk.push_back({vr, {vc - 1, {lx + 1, rx}}});
      }
    }
    if (rx < y) {
      if (vc + 1 <= m && a[vr][vc + 1] != '*') {
        dk.push_back({vr, {vc + 1, {lx, rx + 1}}});
      }
    }
  }
  cout << ans;
}
