#include <bits/stdc++.h>
using namespace std;
int const N = 2e3 + 5;
int xx[] = {0, 0, 1, -1};
int yy[] = {-1, 1, 0, 0};
int n, m, ok[N][N];
char a[N][N];
pair<int, int> dp[N][N];
priority_queue<pair<int, pair<int, int> > > que;
void bfs(int r, int c, int numl, int numr) {
  que.push(make_pair(numl + numr, make_pair(r, c)));
  dp[r][c] = make_pair(numl, numr);
  while (!que.empty()) {
    pair<int, pair<int, int> > p = que.top();
    que.pop();
    int x = p.second.first;
    int y = p.second.second;
    for (int h = 3; h >= 0; h--) {
      int restl = dp[x][y].first;
      int restr = dp[x][y].second;
      int u = x + xx[h];
      int v = y + yy[h];
      if (u < 1 || u > n || v < 1 || v > m || a[u][v] == '*') continue;
      if (h == 0 && restl == 0) continue;
      if (h == 1 && restr == 0) continue;
      if (h == 0) {
        restl--;
      }
      if (h == 1) {
        restr--;
      }
      if (dp[u][v].first + dp[u][v].second < restl + restr &&
          dp[u][v] != make_pair(-1, -1)) {
        dp[u][v] = make_pair(restl, restr);
        que.push(make_pair(restl + restr, make_pair(u, v)));
        continue;
      }
      if (dp[u][v] != make_pair(-1, -1)) continue;
      dp[u][v] = make_pair(restl, restr);
      que.push(make_pair(restl + restr, make_pair(u, v)));
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  int r, c, numl, numr;
  cin >> r >> c;
  cin >> numl >> numr;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      dp[i][j] = make_pair(-1, -1);
      cin >> a[i][j];
    }
  }
  bfs(r, c, numl, numr);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (dp[i][j] != make_pair(-1, -1)) {
        ans++;
      } else {
      }
    }
  }
  cout << ans << endl;
}
