#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
int row_num[] = {-1, 1, 0, 0};
int col_num[] = {0, 0, -1, 1};
char Move[] = {'U', 'D', 'L', 'R'};
int n, m, r, c, x, y, row, col;
class pqNode {
 public:
  int left_move;
  int right_move;
  pair<int, int> coord;
  pqNode(int left_move1, int right_move1, pair<int, int> coord1) {
    left_move = left_move1;
    right_move = right_move1;
    coord = coord1;
  }
  pqNode() {}
};
class myCompare {
 public:
  bool operator()(const pqNode &p1, const pqNode &p2) {
    return p1.left_move + p1.right_move > p2.left_move + p2.right_move;
  }
};
bool check(int i, int j, int n, int m) {
  return i >= 0 && j >= 0 && i < n && j < m;
}
int main() {
  cin >> n >> m >> r >> c >> x >> y;
  r--;
  c--;
  vector<vector<char>> v(n, vector<char>(m));
  vector<vector<bool>> visited(n, vector<bool>(m, false));
  vector<vector<int>> dist(n, vector<int>(m, inf));
  vector<vector<pair<int, int>>> moves(n,
                                       vector<pair<int, int>>(m, {inf, inf}));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> v[i][j];
    }
  }
  priority_queue<pqNode, vector<pqNode>, myCompare> pq;
  pq.push(pqNode(0, 0, {r, c}));
  dist[r][c] = 0;
  pqNode curr;
  while (!pq.empty()) {
    curr = pq.top();
    pq.pop();
    int cRow = curr.coord.first;
    int cCol = curr.coord.second;
    if (visited[cRow][cCol]) {
      continue;
    }
    moves[cRow][cCol] = {curr.left_move, curr.right_move};
    visited[cRow][cCol] = true;
    for (int i = 0; i < 4; i++) {
      row = cRow + row_num[i];
      col = cCol + col_num[i];
      if (!check(row, col, n, m) || v[row][col] == '*') {
        continue;
      }
      int left_move = curr.left_move, right_move = curr.right_move;
      int offset = 0;
      if (Move[i] == 'L') {
        left_move++;
        offset = 1;
      } else if (Move[i] == 'R') {
        right_move++;
        offset = 1;
      }
      if (dist[cRow][cCol] + offset < dist[row][col]) {
        dist[row][col] = dist[cRow][cCol] + offset;
        pq.push(pqNode(left_move, right_move, {row, col}));
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (moves[i][j].first <= x && moves[i][j].second <= y) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
