#include <bits/stdc++.h>
using namespace std;
struct movez {
  int xx, yy;
  int movesL, movesR;
};
int bfs(vector<string> &lab, int n, int m, int r, int c, int x, int y) {
  vector<vector<bool>> vis(n, vector<bool>(m));
  deque<movez> d;
  d.push_back({r, c, x, y});
  vis[r][c] = true;
  while (!d.empty()) {
    auto q = d.front();
    d.pop_front();
    if (q.xx > 0) {
      if (lab[q.xx - 1][q.yy] != '*') {
        if (!vis[q.xx - 1][q.yy]) {
          vis[q.xx - 1][q.yy] = true;
          d.push_front({q.xx - 1, q.yy, q.movesL, q.movesR});
        }
      }
    }
    if (q.xx < n - 1) {
      if (lab[q.xx + 1][q.yy] != '*') {
        if (!vis[q.xx + 1][q.yy]) {
          vis[q.xx + 1][q.yy] = true;
          d.push_front({q.xx + 1, q.yy, q.movesL, q.movesR});
        }
      }
    }
    if (q.yy > 0) {
      if (lab[q.xx][q.yy - 1] != '*') {
        if (!vis[q.xx][q.yy - 1] && q.movesL > 0) {
          vis[q.xx][q.yy - 1] = true;
          d.push_back({q.xx, q.yy - 1, q.movesL - 1, q.movesR});
        }
      }
    }
    if (q.yy < m - 1) {
      if (lab[q.xx][q.yy + 1] != '*') {
        if (!vis[q.xx][q.yy + 1] && q.movesR > 0) {
          vis[q.xx][q.yy + 1] = true;
          d.push_back({q.xx, q.yy + 1, q.movesL, q.movesR - 1});
        }
      }
    }
  }
  int cnt = 0;
  for (auto i : vis) {
    for (auto j : i) {
      if (j == true) {
        cnt++;
      }
    }
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, r, c, x, y;
  cin >> n >> m >> r >> c >> x >> y;
  r--;
  c--;
  vector<string> lab;
  for (int i = 0; i < n; i++) {
    string x;
    cin >> x;
    lab.push_back(x);
  }
  cout << bfs(lab, n, m, r, c, x, y) << "\n";
}
