#include <bits/stdc++.h>
using namespace std;
const int Z = 3 * (int)1e5 + 111;
const int INF = (int)1e9 + 111;
const int MODF = (int)1e9 + 7;
const int cx[] = {0, 0, 1, -1};
const int cy[] = {1, -1, 0, 0};
struct Point {
  int x, y;
  int cnt_left, cnt_right;
  Point(int x, int y, int a, int b) : x(x), y(y), cnt_left(a), cnt_right(b) {}
};
int n, m, x, y, used[2222][2222];
char a[2222][2222];
bool Check(Point p) {
  if (p.x < 0 || p.y < 0 || p.x >= n || p.y >= m || used[p.x][p.y] ||
      a[p.x][p.y] == '*' || p.cnt_left > x || p.cnt_right > y)
    return false;
  return true;
}
void Bfs(int start_x, int start_y) {
  deque<Point> q;
  q.push_back({start_x, start_y, 0, 0});
  used[start_x][start_y] = true;
  while (q.size()) {
    Point p = q.front();
    q.pop_front();
    for (int i = 0; i < 4; i++) {
      Point new_p = {p.x + cx[i], p.y + cy[i],
                     p.cnt_left + (cy[i] >= 0 ? 0 : 1),
                     p.cnt_right + (cy[i] <= 0 ? 0 : 1)};
      if (Check(new_p)) {
        if (cy[i])
          q.push_back(new_p);
        else
          q.push_front(new_p);
        used[new_p.x][new_p.y] = true;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      ans += used[i][j];
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int r, c;
  cin >> n >> m >> r >> c >> x >> y;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  Bfs(r - 1, c - 1);
  return 0;
}
