#include <bits/stdc++.h>
using namespace std;
const int nax = 2100;
const int INF = 1e9 + 111;
int n, m;
int r, c;
int x, y;
char s[nax][nax];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
bool in(int row, int col) {
  return 1 <= row && row <= n && 1 <= col && col <= m;
}
int dp[nax][nax][2];
bool odw[nax][nax][2];
deque<pair<pair<int, int>, pair<int, int>>> q;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d%d", &r, &c);
  scanf("%d%d", &x, &y);
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) dp[i][j][0] = dp[i][j][1] = INF;
  dp[r][c][0] = dp[r][c][1] = 0;
  q.push_back({{0, 0}, {r, c}});
  while ((int)q.size()) {
    int r = q.front().second.first;
    int c = q.front().second.second;
    int d = q.front().first.second;
    q.pop_front();
    if (odw[r][c][d]) continue;
    odw[r][c][d] = 1;
    for (int g = 0; g <= 3; ++g) {
      int nr = r + dx[g];
      int nc = c + dy[g];
      if (!in(nr, nc) || s[nr][nc] == '*') continue;
      int cost = dp[r][c][0] + (g == 3);
      if (dp[nr][nc][0] > cost) {
        dp[nr][nc][0] = cost;
        if (cost != dp[r][c][0])
          q.push_back({{-cost, 0}, {nr, nc}});
        else
          q.push_front({{-cost, 0}, {nr, nc}});
      }
    }
  }
  q.push_back({{0, 1}, {r, c}});
  while ((int)q.size()) {
    int r = q.front().second.first;
    int c = q.front().second.second;
    int d = q.front().first.second;
    q.pop_front();
    if (odw[r][c][d]) continue;
    odw[r][c][d] = 1;
    for (int g = 0; g <= 3; ++g) {
      int nr = r + dx[g];
      int nc = c + dy[g];
      if (!in(nr, nc) || s[nr][nc] == '*') continue;
      int cost = dp[r][c][1] + (g == 2);
      if (dp[nr][nc][1] > cost) {
        dp[nr][nc][1] = cost;
        if (cost != dp[r][c][1])
          q.push_back({{-cost, 1}, {nr, nc}});
        else
          q.push_front({{-cost, 1}, {nr, nc}});
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (j <= c) {
        ans += (dp[i][j][1] <= y && (c - j + dp[i][j][1]) <= x);
      } else {
        ans += (dp[i][j][0] <= x && (j - c + dp[i][j][0] <= y));
      }
    }
  printf("%d", ans);
  return 0;
}
