#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout.setf(ios_base::fixed);
  cout.precision(28);
  string s;
  int n, m;
  cin >> n >> m;
  int sx, sy;
  cin >> sx >> sy;
  sx--;
  sy--;
  vector<vector<char>> table(n, vector<char>(m));
  int x, y;
  cin >> x >> y;
  vector<vector<pair<int, int>>> dist(n, vector<pair<int, int>>(m, {INF, INF}));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> table[i][j];
    }
  }
  dist[sx][sy] = {0, 0};
  vector<pair<int, int>> steps = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
  deque<pair<int, int>> q = {{sx, sy}};
  while (!q.empty()) {
    int vx = q.front().first;
    int vy = q.front().second;
    q.pop_front();
    auto d = dist[vx][vy];
    for (auto step : steps) {
      int nx = vx + step.first;
      int ny = vy + step.second;
      auto nd = d;
      if (nx < 0 || ny < 0 || nx >= n || ny >= m) {
        continue;
      }
      if (table[nx][ny] == '*') {
        continue;
      }
      if (step.second == 0) {
        if (dist[nx][ny] > nd) {
          dist[nx][ny] = nd;
          q.push_front({nx, ny});
        }
      } else {
        if (step.second == 1) {
          nd.second++;
        } else {
          nd.first++;
        }
        if (dist[nx][ny] > nd) {
          dist[nx][ny] = nd;
          q.push_back({nx, ny});
        }
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (dist[i][j].first <= x && dist[i][j].second <= y) {
        cnt++;
      } else {
      }
    }
  }
  cout << cnt;
  return 0;
}
