#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> nei = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, r, c, x, y;
  cin >> n >> m >> r >> c >> x >> y;
  vector<vector<bool>> grid(n + 1, vector<bool>(m + 1, true));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      if (c == '*') {
        grid[i][j] = false;
      }
    }
  }
  vector<vector<int>> seen(n + 1, vector<int>(m + 1, INT_MAX));
  deque<vector<int>> dq;
  dq.push_back({r, c});
  seen[r][c] = 0;
  while (!dq.empty()) {
    vector<int> curr = dq.front();
    dq.pop_front();
    for (int k = 0; k < 4; k++) {
      int rr = curr[0] + nei[k].first, cc = curr[1] + nei[k].second;
      if (rr > n || rr < 1 || cc > m || cc < 1 || !grid[rr][cc] ||
          seen[rr][cc] <= seen[curr[0]][curr[1]] + (k == 3)) {
        continue;
      }
      if (k == 3) {
        dq.push_back({rr, cc});
      } else {
        dq.push_front({rr, cc});
      }
      seen[rr][cc] = seen[curr[0]][curr[1]] + (k == 3);
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (seen[i][j] <= x && j - c + seen[i][j] <= y) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
