#include <bits/stdc++.h>
using namespace std;
long long n, m, r, c, x, y;
vector<vector<long long> > a;
vector<vector<pair<long long, long long> > > met, met1;
queue<pair<long long, long long> > q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> r >> c >> x >> y;
  a.resize(n + 1);
  met.resize(n + 1);
  met1.resize(n + 1);
  for (long long i = 1; i <= n; i++) {
    a[i].resize(m + 1);
    met[i].resize(m + 1, {-1, -1});
    met1[i].resize(m + 1, {0, 0});
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      char zz;
      cin >> zz;
      if (zz == '*') a[i][j] = 1;
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      if (i == 1)
        met1[i][j] = {i, j};
      else {
        if (a[i - 1][j] == 1)
          met1[i][j] = {i, j};
        else
          met1[i][j] = met1[i - 1][j];
      }
    }
  }
  while (r > 1 && a[r - 1][c] != 1) {
    r--;
  }
  met[r][c] = {x, y};
  q.push({r, c});
  while (!q.empty()) {
    pair<long long, long long> w = q.front();
    long long x1 = w.first, y1 = w.second, xx = x1;
    while (xx <= n && a[xx][y1] == 0) {
      if (y1 - 1 > 0 && a[xx][y1 - 1] != 1 && met[x1][y1].first != 0) {
        long long x2 = met1[xx][y1 - 1].first, y2 = met1[xx][y1 - 1].second;
        if (met[x2][y2].first == -1) {
          q.push({x2, y2});
          met[x2][y2] = {met[x1][y1].first - 1, met[x1][y1].second};
        }
      }
      if (y1 + 1 <= m && a[xx][y1 + 1] != 1 && met[x1][y1].second != 0) {
        long long x2 = met1[xx][y1 + 1].first, y2 = met1[xx][y1 + 1].second;
        if (met[x2][y2].first == -1) {
          q.push({x2, y2});
          met[x2][y2] = {met[x1][y1].first, met[x1][y1].second - 1};
        }
      }
      xx++;
    }
    q.pop();
  }
  long long k = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      if (met[i][j].first == -1) continue;
      long long t1 = i, t2 = j;
      k++;
      while (t1 < n && a[t1 + 1][t2] != 1) {
        t1++;
        k++;
      }
    }
  }
  cout << k;
}
