#include <bits/stdc++.h>
using namespace std;
long long n, m, s, e, L, R, a[int(5 + 3000)][int(5 + 3000)], ans;
deque<pair<pair<int, int>, pair<int, int> > > q;
void pu(int i, int j, int l, int r, bool T) {
  if (i <= n && i > 0 && j <= m && j > 0 && !a[i][j] && l >= 0 && r >= 0) {
    if (!T)
      q.push_front(pair<pair<int, int>, pair<int, int> >(pair<int, int>(i, j),
                                                         pair<int, int>(l, r)));
    else
      q.push_back(pair<pair<int, int>, pair<int, int> >(pair<int, int>(i, j),
                                                        pair<int, int>(l, r)));
    a[i][j] = 2;
    ans++;
  }
}
int main() {
  cin >> n >> m >> s >> e >> L >> R;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      a[i][j] = (c == '*');
    }
  pu(s, e, L, R, 0);
  while (!q.empty()) {
    pair<pair<int, int>, pair<int, int> > c = q.front();
    q.pop_front();
    int i = c.first.first;
    int j = c.first.second;
    int l = c.second.first;
    int r = c.second.second;
    pu(i + 1, j, l, r, 0);
    pu(i - 1, j, l, r, 0);
    pu(i, j + 1, l, r - 1, 1);
    pu(i, j - 1, l - 1, r, 1);
  }
  cout << ans << endl;
  return 0;
}
