#include <bits/stdc++.h>
using namespace std;
void getint(int &v) {
  char ch, fu = 0;
  for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') fu = 1, ch = getchar();
  for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
  if (fu) v = -v;
}
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
char s[2010][2010];
int n, m, r, c, he, ta, x, y, ans, d[2010][2010];
pair<int, int> q[10000010];
void bfs() {
  he = 5000000;
  ta = 5000001;
  q[ta] = make_pair(r, c);
  memset(d, -1, sizeof(d));
  d[r][c] = 0;
  while (he != ta) {
    pair<int, int> x = q[++he];
    for (int D = 0; D <= 3; ++D) {
      pair<int, int> y = make_pair(x.first + dx[D], x.second + dy[D]);
      if (y.first < 1 || y.first > n || y.second < 1 || y.second > m) continue;
      if (d[y.first][y.second] != -1 || s[y.first][y.second] == '*') continue;
      d[y.first][y.second] = d[x.first][x.second] + (x.second != y.second);
      if (x.second != y.second)
        q[++ta] = y;
      else
        q[he--] = y;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  cin >> r >> c >> x >> y;
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s[i] + 1);
  }
  bfs();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      int t = d[i][j];
      if (t == -1) continue;
      int R = (t + j - c) / 2, L = t - R;
      if (R <= y && L <= x) ++ans;
    }
  cout << ans << endl;
  return 0;
}
