#include <bits/stdc++.h>
using namespace std;
long long int n, m;
char arr[2004][2004];
pair<int, int> v[2004][2004];
long long int dist[8000003];
const long long int oo = 1000000007;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
int get_node(int x, int y) { return x * m + y; }
void bfs(int r, int c) {
  for (int i = 0; i < n * m; i++) dist[i] = oo;
  dist[get_node(r, c)] = 0;
  deque<pair<int, int>> dq;
  dq.push_back({r, c});
  v[r][c] = {0, 0};
  while (!dq.empty()) {
    int x = dq[0].first;
    int y = dq[0].second;
    dq.pop_front();
    for (int i = 0; i < 4; i++) {
      int xx = x + dx[i];
      int yy = y + dy[i];
      if (xx < 0 || xx >= n || yy < 0 || yy >= m) continue;
      if (arr[xx][yy] == '*') continue;
      int flag = 0;
      if (yy < y) flag = 1;
      int node = get_node(xx, yy);
      int u = get_node(x, y);
      if (dist[node] > dist[u] + flag) {
        dist[node] = dist[u] + flag;
        v[xx][yy] = v[x][y];
        if (i == 2) v[xx][yy].second++;
        if (i == 3) v[xx][yy].first++;
        if (flag)
          dq.push_back({xx, yy});
        else
          dq.push_front({xx, yy});
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  long long int r, c;
  cin >> r >> c;
  r--;
  c--;
  long long int le, ri;
  cin >> le >> ri;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> arr[i][j], v[i][j] = {oo, oo};
  bfs(r, c);
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == '*') continue;
      if (v[i][j].first <= le && v[i][j].second <= ri) ans++;
    }
  }
  cout << ans << '\n';
}
