#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int dle[] = {0, 0, -1, 0};
int dri[] = {0, 0, 0, -1};
int n, m, ans, fix[2001][2001];
struct struc {
  int a, b, c, d;
};
deque<struc> q1;
char ch[2001][2001];
bool check(int x, int y, int Le, int Ri) {
  if (x > n || x < 1 || y < 1 || y > m || Le < 0 || Ri < 0 || ch[x][y] == '*' ||
      fix[x][y])
    return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  int l, r, le, ri;
  cin >> n >> m >> l >> r >> le >> ri;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> ch[i][j];
    }
  }
  q1.push_front({l, r, le, ri});
  while (q1.size()) {
    struc x = q1.front();
    q1.pop_front();
    if (fix[x.a][x.b]) continue;
    fix[x.a][x.b] = 1;
    for (int i = 0; i < 2; i++) {
      if (!check(x.a + dx[i], x.b + dy[i], x.c + dle[i], x.d + dri[i]))
        continue;
      q1.push_front({x.a + dx[i], x.b + dy[i], x.c + dle[i], x.d + dri[i]});
    }
    for (int i = 2; i < 4; i++) {
      if (!check(x.a + dx[i], x.b + dy[i], x.c + dle[i], x.d + dri[i]))
        continue;
      q1.push_back({x.a + dx[i], x.b + dy[i], x.c + dle[i], x.d + dri[i]});
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      ans += fix[i][j];
    }
  }
  cout << ans;
}
