#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int INF = (int)1e9;
int n, m, r0, c0, x, y, dist[N][N], dx[4] = {-1, 0, 1, 0},
                                    dy[4] = {0, -1, 0, 1}, dc[4] = {0, 1, 0, 0};
char board[N][N];
bool visited[N][N];
deque<pair<int, int> > q;
int main() {
  scanf("%d %d %d %d %d %d", &n, &m, &r0, &c0, &x, &y);
  r0--;
  c0--;
  for (int i = 0; i < n; i++) {
    scanf("%s", board[i]);
  }
  q.push_back(make_pair(r0, c0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      dist[i][j] = INF;
      visited[i][j] = false;
    }
  }
  dist[r0][c0] = 0;
  while (!q.empty()) {
    int r = q.front().first;
    int c = q.front().second;
    q.pop_front();
    if (visited[r][c]) {
      continue;
    }
    visited[r][c] = true;
    for (int d = 0; d < 4; d++) {
      int nr = r + dx[d];
      int nc = c + dy[d];
      int cost = dc[d];
      if (nr < 0 || nr >= n || nc < 0 || nc >= m) {
        continue;
      }
      if (board[nr][nc] == '*') {
        continue;
      }
      if (dist[nr][nc] > dist[r][c] + cost) {
        dist[nr][nc] = dist[r][c] + cost;
        if (cost != 0) {
          q.push_back(make_pair(nr, nc));
        } else {
          q.push_front(make_pair(nr, nc));
        }
      }
    }
  }
  int answer = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int left = dist[i][j];
      if (left == INF) {
        continue;
      }
      int right = j - (c0 - left);
      answer += ((left <= x && right <= y) ? 1 : 0);
    }
  }
  printf("%d\n", answer);
  return 0;
}
