#include <bits/stdc++.h>
using namespace std;
inline void init() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
const int N = 2001;
const int INF = 0x3f3f3f3f;
int g[N][N];
bool vis[N][N];
int lft[N][N];
void test() {
  int n, m;
  cin >> n >> m;
  int r, c;
  cin >> r >> c;
  r--, c--;
  int x, y;
  cin >> x >> y;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      g[i][j] = (c == '*');
    }
  }
  memset(lft, INF, sizeof lft);
  deque<pair<int, int> > dq;
  lft[r][c] = 0;
  dq.push_front({r, c});
  auto disp_dq = [&]() {
    for (pair<int, int> val : dq) {
      cout << '{' << val.first << ',' << val.second << '}';
    }
    cout << endl;
  };
  while (!dq.empty()) {
    pair<int, int> cur = dq.front();
    dq.pop_front();
    vis[cur.first][cur.second] = true;
    for (int i = 0; i < 4; i++) {
      pair<int, int> nxt = cur;
      nxt.first = cur.first + dx[i];
      nxt.second = cur.second + dy[i];
      if (nxt.first < 0 or nxt.first >= n or nxt.second < 0 or nxt.second >= m)
        continue;
      if (g[nxt.first][nxt.second] == 1 or vis[nxt.first][nxt.second]) continue;
      if (i) {
        if (lft[nxt.first][nxt.second] > lft[cur.first][cur.second]) {
          lft[nxt.first][nxt.second] = lft[cur.first][cur.second];
          dq.push_front(nxt);
        }
      } else {
        if (lft[nxt.first][nxt.second] > lft[cur.first][cur.second] + 1) {
          lft[nxt.first][nxt.second] = lft[cur.first][cur.second] + 1;
          dq.push_back(nxt);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (lft[i][j] == INF) continue;
      int rr = lft[i][j] + (j - c);
      if (lft[i][j] <= x and rr <= y) ans++;
    }
  }
  cout << ans << '\n';
}
int main() {
  init();
  test();
  return 0;
}
