#include <bits/stdc++.h>
using namespace std;
int dist[2005][2005];
char f[2005][2005];
int n, m, r, c, x, y;
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &r, &c, &x, &y);
  x = min(x, 10000000);
  y = min(y, 10000000);
  r--;
  c--;
  for (int i = 0; i < n; i++) scanf("%s", &f[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) dist[i][j] = 1000000000;
  dist[r][c] = 0;
  deque<pair<int, pair<int, int> > > que;
  que.push_back(make_pair(0, make_pair(r, c)));
  while (!que.empty()) {
    pair<int, pair<int, int> > p = que.front();
    que.pop_front();
    if (p.first != dist[p.second.first][p.second.second]) continue;
    int X = p.second.first, Y = p.second.second;
    int dx[4] = {0, 1, 0, -1};
    int dy[4] = {1, 0, -1, 0};
    for (int k = 0; k < 4; k++) {
      int nx = X + dx[k], ny = Y + dy[k];
      if (!(0 <= nx && nx < n && 0 <= ny && ny < m)) continue;
      if (f[nx][ny] == '*') continue;
      int add = (k == 2);
      if (dist[nx][ny] > p.first + add) {
        dist[nx][ny] = p.first + add;
        if (add == 0)
          que.push_front(make_pair(p.first + add, make_pair(nx, ny)));
        else
          que.push_back(make_pair(p.first + add, make_pair(nx, ny)));
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      int mnx = dist[i][j];
      int mny = j + dist[i][j] - c;
      if (mnx <= x && mny <= y) ans++;
    }
  cout << ans << endl;
}
