#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
int n, m, r, c, lx, rx, ans;
char s[maxn][maxn];
bool vis[maxn][maxn];
int main() {
  scanf("%d %d %d %d %d %d", &n, &m, &r, &c, &lx, &rx);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  deque<pair<pair<int, int>, int> > q;
  q.push_front({{r, c}, 0});
  while (!q.empty()) {
    auto p = q.front();
    q.pop_front();
    if (s[p.first.first][p.first.second] == '*' ||
        vis[p.first.first][p.first.second] || p.second > lx ||
        p.second + p.first.second - c > rx)
      continue;
    vis[p.first.first][p.first.second] = 1;
    if (p.first.first - 1 >= 1)
      q.push_front({{p.first.first - 1, p.first.second}, p.second});
    if (p.first.first + 1 <= n)
      q.push_front({{p.first.first + 1, p.first.second}, p.second});
    if (p.first.second - 1 >= 1)
      q.push_back({{p.first.first, p.first.second - 1}, p.second + 1});
    if (p.first.second + 1 <= m)
      q.push_front({{p.first.first, p.first.second + 1}, p.second});
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) ans += vis[i][j];
  printf("%d\n", ans);
  return 0;
}
