#include <bits/stdc++.h>
using namespace std;
const int dl[] = {-1, 0, 1, 0};
const int dc[] = {0, -1, 0, 1};
struct pozitie {
  int l, c;
};
pozitie poz, poz2;
int N, M, i, j, L, C, X, Y, d;
int dp[2005][2005], ANS, st, dr, nr;
string S[2005];
queue<pozitie> Q;
void BFS() {
  dp[L][C] = 0;
  poz.l = L;
  poz.c = C;
  Q.push(poz);
  while (Q.empty() == false) {
    poz = Q.front();
    Q.pop();
    for (d = 0; d <= 3; d++) {
      poz2.l = poz.l + dl[d];
      poz2.c = poz.c + dc[d];
      if (poz2.l == 0 || poz2.l > N) continue;
      if (poz2.c == 0 || poz2.c > M) continue;
      if (S[poz2.l][poz2.c] == '*') continue;
      if (d == 1)
        nr = 1;
      else
        nr = 0;
      if (dp[poz2.l][poz2.c] > dp[poz.l][poz.c] + nr) {
        dp[poz2.l][poz2.c] = dp[poz.l][poz.c] + nr;
        Q.push(poz2);
      }
    }
  }
}
int main() {
  cin >> N >> M >> L >> C >> X >> Y;
  for (i = 1; i <= N; i++) {
    cin >> S[i];
    S[i] = '*' + S[i];
    for (j = 1; j <= M; j++) dp[i][j] = 1000000000;
  }
  BFS();
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= M; j++) {
      if (S[i][j] == '*') continue;
      st = dp[i][j];
      dr = j - (C - st);
      if (st <= X && dr <= Y) {
        ANS++;
      }
    }
  }
  cout << ANS << '\n';
  return 0;
}
