#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, r1, c1, i, j;
vector<vector<long long>> a;
vector<vector<char>> c;
deque<pair<long long, long long>> q;
int main() {
  cin >> n >> m >> r1 >> c1 >> x >> y;
  a.resize(n);
  for (i = 0; i < n; i++) {
    a[i].resize(m);
  }
  c.resize(n);
  for (i = 0; i < n; i++) {
    c[i].resize(m);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      a[i][j] = 1000000;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> c[i][j];
    }
  }
  int ans = 0;
  q.push_front({r1 - 1, c1 - 1});
  a[r1 - 1][c1 - 1] = 0;
  while (!q.empty()) {
    pair<long long, long long> temp = q.front();
    long long x1, y1;
    x1 = temp.first;
    y1 = temp.second;
    q.pop_front();
    if (y1 + 1 < m && a[x1][y1] + 1 < a[x1][y1 + 1] && c[x1][y1 + 1] != '*') {
      a[x1][y1 + 1] = a[x1][y1] + 1;
      q.push_back({x1, y1 + 1});
    }
    if (y1 - 1 >= 0 && a[x1][y1] < a[x1][y1 - 1] && c[x1][y1 - 1] != '*') {
      a[x1][y1 - 1] = a[x1][y1];
      q.push_front({x1, y1 - 1});
    }
    if (x1 - 1 >= 0 && a[x1][y1] < a[x1 - 1][y1] && c[x1 - 1][y1] != '*') {
      a[x1 - 1][y1] = a[x1][y1];
      q.push_front({x1 - 1, y1});
    }
    if (x1 + 1 < n && a[x1][y1] < a[x1 + 1][y1] && c[x1 + 1][y1] != '*') {
      a[x1 + 1][y1] = a[x1][y1];
      q.push_front({x1 + 1, y1});
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] != 1000000) {
        long long temp1, temp2;
        temp1 = a[i][j];
        temp2 = temp1 + (c1 - 1) - j;
        if (temp1 <= y && temp2 <= x) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
