#include <bits/stdc++.h>
using namespace std;
long long n, m;
struct pt {
  long long x, y;
  pt() {}
  pt(long long x, long long y) : x(x), y(y) {}
};
vector<vector<long long>> used;
vector<vector<long long>> g;
void parasha(pt q, pt p, long long weight, deque<pt>& bfs,
             vector<vector<long long>>& w) {
  if (q.x < 0 || q.y < 0 || q.x >= n || q.y >= m) return;
  if (g[q.x][q.y] == '*') return;
  if (w[q.x][q.y] > w[p.x][p.y] + weight) {
    w[q.x][q.y] = w[p.x][p.y] + weight;
    if (weight == 1)
      bfs.push_back(q);
    else
      bfs.push_front(q);
  }
}
int32_t main() {
  deque<pt> bfs;
  cin >> n >> m;
  vector<vector<long long>> w(n, vector<long long>(m, 3e9));
  g.assign(n, vector<long long>(m));
  used.assign(n, vector<long long>(m, 0));
  long long r, c;
  cin >> r >> c;
  --r;
  --c;
  long long x, y;
  cin >> x >> y;
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      char x;
      cin >> x;
      g[i][j] = x;
    }
  }
  bfs.push_back(pt(r, c));
  w[r][c] = 0;
  while (!bfs.empty()) {
    pt q = bfs.front();
    bfs.pop_front();
    if (used[q.x][q.y] == 1) {
      continue;
    }
    used[q.x][q.y] = 1;
    parasha(pt(q.x, q.y + 1), q, 0, bfs, w);
    parasha(pt(q.x + 1, q.y), q, 0, bfs, w);
    parasha(pt(q.x - 1, q.y), q, 0, bfs, w);
    parasha(pt(q.x, q.y - 1), q, 1, bfs, w);
  }
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < m; ++j) {
      if (w[i][j] <= x && w[i][j] - (c - j) <= y) ++ans;
    }
  }
  cout << ans;
}
