#include <bits/stdc++.h>
using namespace std;
int const M = 4000009;
int const N = 2009;
long long m, n, r, c, LL, RR, d[M], res;
vector<vector<pair<long long, long long> > > e(M);
int incx[] = {-1, 0, 1, 0};
int incy[] = {0, 1, 0, -1};
string s[N];
long long ver(int i, int j) { return (i - 1) * n + j; }
bool ok(int i, int j) { return (i > 0 && j > 0 && i <= m && j <= n); }
void dijkstra() {
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  for (int i = 1; i <= m * n; i++) d[i] = 1e18;
  d[ver(r, c)] = 0;
  q.push(pair<long long, long long>(0, ver(r, c)));
  while (!q.empty()) {
    long long du = q.top().first, u = q.top().second;
    q.pop();
    if (du != d[u]) continue;
    for (int i = 0; i < e[u].size(); i++) {
      long long v = e[u][i].first, add = e[u][i].second;
      if (d[v] > d[u] + add) {
        d[v] = d[u] + add;
        q.push(pair<long long, long long>(d[v], v));
      }
    }
  };
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> m >> n >> r >> c >> LL >> RR;
  for (int i = 1; i <= m; i++) cin >> s[i], s[i] = " " + s[i];
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++)
      if (s[i][j] != '*')
        for (int t = 0; t < 4; t++) {
          int x = i + incx[t], y = j + incy[t];
          if (!ok(x, y) || s[x][y] == '*') continue;
          int add(0);
          if (t == 3) add = 1;
          e[ver(i, j)].push_back(pair<long long, long long>(ver(x, y), add));
        }
  dijkstra();
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      if (d[ver(i, j)] <= LL && d[ver(i, j)] + j <= RR + c) res++;
    }
  cout << res;
  return 0;
}
