#include <bits/stdc++.h>
const long long int MAX = 2000;
long long int dist[MAX][MAX];
char g[MAX][MAX + 1];
long long int dx[] = {0, 1, 0, -1};
long long int dy[] = {-1, 0, 1, 0};
using namespace std;
void clear() { memset(dist, 0, sizeof(dist)); }
void solve() {
  long long int n, m, r, c, x, y;
  cin >> n >> m >> r >> c >> x >> y;
  long long int ans = 0;
  r--;
  c--;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> g[i][j];
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      dist[i][j] = 2e9;
    }
  }
  deque<pair<long long int, long long int>> q;
  dist[r][c] = 0;
  q.push_front(make_pair(r, c));
  while (!q.empty()) {
    long long int i = q.front().first;
    long long int j = q.front().second;
    q.pop_front();
    for (long long int k = 0; k < 4; k++) {
      long long int ni = i + dx[k];
      long long int nj = j + dy[k];
      if (ni == -1 or ni == n or nj == -1 or nj == m or g[ni][nj] == '*') {
        continue;
      } else {
        long long int nd = dist[i][j] + (k == 0);
        if (dist[ni][nj] <= nd) {
          continue;
        } else {
          dist[ni][nj] = nd;
        }
        if (k) {
          q.push_front(make_pair(ni, nj));
        } else {
          q.push_back(make_pair(ni, nj));
        }
      }
    }
  }
  long long int res = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      long long int pre = dist[i][j];
      long long int mr = pre + j - c;
      if (pre <= x and mr <= y) ans++;
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
