#include <bits/stdc++.h>
using namespace std;
struct data2 {
  int x, y, ertek;
};
struct comp {
  bool operator()(data2 &a, data2 &b) const { return a.ertek > b.ertek; }
};
bool volt[2002][2002] = {};
priority_queue<data2, deque<data2>, comp> pq;
int DB = 0;
int n, m, moveR, moveL;
int sx, sy;
void Dijkstra() {
  pq.push({sx, sy, 0});
  while (pq.size()) {
    int x = pq.top().x, y = pq.top().y, e = pq.top().ertek;
    pq.pop();
    if (volt[x][y]) continue;
    int d = sy - y + e;
    if (d <= moveL && e <= moveR) ++DB;
    volt[x][y] = true;
    if (x - 1 > 0 && !volt[x - 1][y]) pq.push({x - 1, y, e});
    if (x + 1 < n + 1 && !volt[x + 1][y]) pq.push({x + 1, y, e});
    if (y - 1 > 0 && !volt[x][y - 1]) pq.push({x, y - 1, e});
    if (y + 1 < m + 1 && !volt[x][y + 1]) pq.push({x, y + 1, e + 1});
  }
  return;
}
int main() {
  cin >> n >> m >> sx >> sy >> moveL >> moveR;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      if (s[j] == '*') {
        volt[i + 1][j + 1] = true;
      }
    }
  }
  Dijkstra();
  cout << DB << "\n";
  return 0;
}
