#include <bits/stdc++.h>
using namespace std;
const long long LLINF = 1e18;
const int INF = 1e9;
const int MOD = 20101009;
const int HMOD = 999959;
const int VMOD = 5000000;
const int MAXN = 2e3 + 10;
const int MAXM = 5e5 + 10;
const int INV = 10050505;
const long long LLINV = 1e18;
const double eps = 1e-3;
int dirx[4] = {-1, 1, 0, 0}, diry[4] = {0, 0, -1, 1};
int n, m;
int r, c;
int limx, limy;
char G[MAXN][MAXN];
int dl[MAXN][MAXN];
int dr[MAXN][MAXN];
void bfs() {
  memset(dl, 0x3f3f3f3f, sizeof(dl));
  memset(dr, 0x3f3f3f3f, sizeof(dr));
  deque<pair<int, int> > que;
  que.push_front(make_pair(r, c));
  dl[r][c] = dr[r][c] = 0;
  while (!que.empty()) {
    int x = que.front().first;
    int y = que.front().second;
    que.pop_front();
    for (int i = 0; i < 4; ++i) {
      int tx = x + dirx[i];
      int ty = y + diry[i];
      if (tx < 1 || tx > n || ty < 1 || ty > m) continue;
      if (G[tx][ty] == '*') continue;
      int cl = dl[x][y] + (diry[i] == -1);
      int cr = dr[x][y] + (diry[i] == 1);
      if (cl < dl[tx][ty] || cr < dr[tx][ty]) {
        dl[tx][ty] = cl;
        dr[tx][ty] = cr;
        if (dirx[i] == 0)
          que.push_back(make_pair(tx, ty));
        else
          que.push_front(make_pair(tx, ty));
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  scanf("%d%d", &n, &m);
  scanf("%d%d", &r, &c);
  scanf("%d%d", &limx, &limy);
  for (int i = 1; i <= n; ++i) scanf("%s", G[i] + 1);
  bfs();
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (G[i][j] == '*') continue;
      if (dl[i][j] <= limx && dr[i][j] <= limy) ++ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}
