#include <bits/stdc++.h>
using namespace std;
void setIO(const string &name = "") {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  if (name.length()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
template <typename T>
void read(vector<T> &a) {
  for (auto &x : a) cin >> x;
}
template <typename T>
void read(vector<T> &a, long long n) {
  a.resize(n);
  for (auto &x : a) cin >> x;
}
template <typename T>
void print(vector<T> &a) {
  for (const auto &x : a) cout << x << ' ';
  cout << '\n';
}
void MOD(long long &x) {
  x %= 1000000007;
  if (x < 0) x += 1000000007;
}
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long n, m;
long long r, c;
long long x, y;
vector<string> board;
long long cnt = 0;
vector<vector<long long> > dist;
long long dx[4] = {0, 0, -1, 1};
long long dy[4] = {-1, 1, 0, 0};
long long cost[4] = {0, 1, 0, 0};
bool isValid(long long a, long long b) {
  return a >= 0 and b >= 0 and a < n and b < m and board[a][b] == '.';
}
int32_t main() {
  setIO();
  cin >> n >> m >> r >> c >> x >> y;
  read(board, n);
  --r, --c;
  dist.resize(n, vector<long long>(m));
  for (auto &e : dist)
    for (auto &d : e) d = 1e18 + 5;
  deque<pair<long long, long long> > q;
  dist[r][c] = 0;
  q.emplace_back(make_pair(r, c));
  while (!q.empty()) {
    pair<long long, long long> v = q.front();
    q.pop_front();
    for (auto(i) = 0; i < 4; i++) {
      long long curx = v.first + dx[i], cury = v.second + dy[i];
      if (!isValid(curx, cury)) continue;
      if (dist[curx][cury] > dist[v.first][v.second] + cost[i]) {
        dist[curx][cury] = dist[v.first][v.second] + cost[i];
        if (cost[i] == 1) {
          q.push_front(make_pair(curx, cury));
        } else
          q.emplace_back(curx, cury);
      }
    }
  }
  long long ans = 0;
  for (auto(i) = 0; i < n; i++) {
    for (auto(j) = 0; j < m; j++) {
      if (dist[i][j] <= y) {
        long long l = dist[i][j] - j + c;
        if (l <= x) ans++;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
