#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long int INF = (long long int)(1e18);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int rows, cols, start_row, start_col, lefts, rights;
  cin >> rows >> cols >> start_row >> start_col >> lefts >> rights;
  char matrix[rows + 1][cols + 1];
  long long int distance[rows + 1][cols + 1];
  for (long long int i = 1ll; i <= rows; i++) {
    for (long long int j = 1ll; j <= cols; j++) {
      cin >> matrix[i][j];
      distance[i][j] = INF;
    }
  }
  distance[start_row][start_col] = 0;
  deque<pair<long long int, long long int>> q;
  q.push_back({start_row, start_col});
  while (!q.empty()) {
    int x = q.front().first, y = q.front().second;
    q.pop_front();
    for (long long int dx = x - 1; dx <= x + 1; dx += 2) {
      long long int dy = y;
      if (dx >= 1 && dx <= rows && matrix[dx][dy] != '*') {
        if (distance[dx][dy] > distance[x][y]) {
          distance[dx][dy] = distance[x][y];
          q.push_front({dx, dy});
        }
      }
    }
    for (long long int dy = y - 1; dy <= y + 1; dy += 2) {
      long long int dx = x;
      if (dy >= 1 && dy <= cols && matrix[dx][dy] != '*') {
        if (distance[dx][dy] > distance[x][y] + 1) {
          distance[dx][dy] = distance[x][y] + 1;
          q.push_back({dx, dy});
        }
      }
    }
  }
  long long int ans = 0ll;
  for (long long int i = 1ll; i <= rows; i++) {
    for (long long int j = 1ll; j <= cols; j++) {
      long long int horizontal_dist = abs(j - start_col);
      long long int total_dist = distance[i][j];
      long long int equal_dist = (total_dist - horizontal_dist) / 2ll;
      long long int left_moves = 0ll, right_moves = 0ll;
      if (j <= start_col) {
        right_moves = equal_dist;
        left_moves = horizontal_dist + equal_dist;
      } else {
        right_moves = horizontal_dist + equal_dist;
        left_moves = equal_dist;
      }
      if (left_moves <= lefts && right_moves <= rights) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
