#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, r, c, x, y;
  cin >> n >> m >> r >> c >> x >> y;
  vector<vector<int>> g(n + 2, vector<int>(m + 2, 1));
  for (int i = 1; i <= n; ++i) {
    string s;
    cin >> s;
    s = " " + s;
    for (int j = 1; j <= m; ++j) {
      if (s[j] == '.') {
        g[i][j] = 0;
      } else {
        g[i][j] = 1;
      }
    }
  }
  vector<vector<int>> dist(n + 2, vector<int>(m + 2, INF));
  dist[r][c] = 0;
  deque<pair<int, int>> d;
  d.push_back({r, c});
  int di[4] = {0, 0, -1, 1};
  int dj[4] = {-1, 1, 0, 0};
  while (!d.empty()) {
    auto [un, um] = d.front();
    d.pop_front();
    for (int k = 0; k < 4; ++k) {
      int vn = un + di[k], vm = um + dj[k];
      if (g[vn][vm] == 0) {
        int w;
        if (k == 0) {
          w = 1;
        } else {
          w = 0;
        }
        if (dist[vn][vm] > dist[un][um] + w) {
          dist[vn][vm] = dist[un][um] + w;
          if (w == 0) {
            d.push_front({vn, vm});
          } else {
            d.push_back({vn, vm});
          }
        }
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (g[i][j] == 0 && dist[i][j] <= x && j - c + dist[i][j] <= y) {
        cnt += 1;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
