#include <bits/stdc++.h>
using namespace std;
int n, m, r, c, x, y;
long long ans;
int d1[] = {1, -1, 0, 0}, d2[] = {0, 0, 1, -1};
char g[2005][2005];
bool v[2005][2005];
struct node {
  int a, b;
  int sx, sy;
  node() {}
  node(int ta, int tb, int tx, int ty) {
    a = ta;
    b = tb;
    sx = tx;
    sy = ty;
  }
  bool operator<(node A) const {
    if (sx == A.sx) return sy > A.sy;
    return sx > A.sx;
  }
};
bool judge(int ta, int tb) {
  if (ta < 1 || ta > n || tb < 1 || tb > m || g[ta][tb] == '*' || !v[ta][tb])
    return false;
  return true;
}
void bfs() {
  priority_queue<node> q;
  node t;
  t.a = r;
  t.b = c;
  t.sx = 0;
  t.sy = 0;
  v[t.a][t.b] = false;
  q.push(t);
  while (!q.empty()) {
    ans++;
    t = q.top();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int ta = t.a + d1[i];
      int tb = t.b + d2[i];
      if (!judge(ta, tb)) continue;
      if (i == 0 || i == 1) {
        node p(ta, tb, t.sx, t.sy);
        v[ta][tb] = false;
        q.push(p);
      } else if (i == 3) {
        if (t.sx < x) {
          node p(ta, tb, t.sx + 1, t.sy);
          v[ta][tb] = false;
          q.push(p);
        }
      } else if (i == 2) {
        if (t.sy < y) {
          node p(ta, tb, t.sx, t.sy + 1);
          v[ta][tb] = false;
          q.push(p);
        }
      }
    }
  }
}
int main(int argc, char** argv) {
  while (cin >> n >> m) {
    cin >> r >> c >> x >> y;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cin >> g[i][j];
      }
    }
    ans = 0;
    memset(v, true, sizeof(v));
    bfs();
    cout << ans << endl;
  }
  return 0;
}
