#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int si, sj;
  cin >> si >> sj;
  si--;
  sj--;
  int left, right;
  cin >> left >> right;
  vector<string> in(n);
  for (int i = 0; i < n; i++) {
    cin >> in[i];
  }
  deque<pair<int, int>> que;
  vector<vector<int>> vis(n, vector<int>(m)), l(vis), r(vis);
  que.push_back(make_pair(si, sj));
  vis[si][sj] = 1;
  while (que.size()) {
    int cur_i = que[0].first;
    int cur_j = que[0].second;
    que.pop_front();
    for (int di = -1; di <= 1; di += 2) {
      int ii = cur_i + di;
      if (ii < 0 || ii >= n || in[ii][cur_j] == '*' || vis[ii][cur_j]) continue;
      vis[ii][cur_j] = 1;
      l[ii][cur_j] = l[cur_i][cur_j];
      r[ii][cur_j] = r[cur_i][cur_j];
      que.push_front(make_pair(ii, cur_j));
    }
    int jj = cur_j - 1;
    if (jj < m && jj >= 0 && !vis[cur_i][jj] && in[cur_i][jj] != '*') {
      vis[cur_i][jj] = 1;
      l[cur_i][jj] = l[cur_i][cur_j] + 1;
      r[cur_i][jj] = r[cur_i][cur_j];
      que.push_back(make_pair(cur_i, jj));
    }
    jj = cur_j + 1;
    if (jj < m && jj >= 0 && !vis[cur_i][jj] && in[cur_i][jj] != '*') {
      vis[cur_i][jj] = 1;
      l[cur_i][jj] = l[cur_i][cur_j];
      r[cur_i][jj] = r[cur_i][cur_j] + 1;
      que.push_back(make_pair(cur_i, jj));
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (vis[i][j] && l[i][j] <= left && r[i][j] <= right) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
