#include <bits/stdc++.h>
using namespace std;
static int N, M, R, C, X, Y, ans, vis[2003][2003];
static char grid[2003][2003];
struct tState {
  int x, y, l, r;
};
inline bool legal(tState s) {
  return 0 <= s.x && s.x < N && 0 <= s.y && s.y < M && grid[s.x][s.y] == '.' &&
         !vis[s.x][s.y] && s.l > -1 && s.r > -1;
}
inline void scan_block(int nx, tState st, queue<tState> &Q) {
  vis[nx][st.y] = 1;
  ans++;
  tState sl = {nx, st.y - 1, st.l - 1, st.r},
         sr = {nx, st.y + 1, st.l, st.r - 1};
  if (legal(sl)) Q.push(sl);
  if (legal(sr)) Q.push(sr);
}
int main() {
  scanf("%d%d%d%d%d%d", &N, &M, &R, &C, &X, &Y);
  for (int i = 0; i < N; i++) scanf("%s", grid[i]);
  queue<tState> Q;
  Q.push({R - 1, C - 1, X, Y});
  while (!Q.empty()) {
    auto st = Q.front();
    Q.pop();
    if (vis[st.x][st.y]) continue;
    for (int i = st.x; 0 <= i && grid[i][st.y] == '.'; i--)
      scan_block(i, st, Q);
    for (int i = st.x + 1; i < N && grid[i][st.y] == '.'; i++)
      scan_block(i, st, Q);
    int stop = 1;
  }
  printf("%d\n", ans);
  return 0;
}
