#include <bits/stdc++.h>
using namespace std;
void bfs(vector<vector<pair<int, int> > > &gr, int r, int c) {
  int n = gr.size();
  int m = gr[0].size();
  queue<pair<int, int> > q;
  gr[r][c] = {0, 0};
  q.push({r, c});
  while (!q.empty()) {
    pair<int, int> pole = q.front();
    int a = pole.first;
    int b = pole.second;
    q.pop();
    for (int s = a; s < n && (gr[s][b].first == -1 || s == a); s++) {
      gr[s][b] = gr[a][b];
      if (b + 1 < m && gr[s][b + 1].first == -1) {
        gr[s][b + 1].first = gr[s][b].first;
        gr[s][b + 1].second = gr[s][b].second + 1;
        q.push({s, b + 1});
      }
      if (b - 1 >= 0 && gr[s][b - 1].first == -1) {
        gr[s][b - 1].first = gr[s][b].first + 1;
        gr[s][b - 1].second = gr[s][b].second;
        q.push({s, b - 1});
      }
    }
    for (int s = a - 1; s >= 0 && gr[s][b].first == -1; s--) {
      gr[s][b] = gr[a][b];
      if (b + 1 < m && gr[s][b + 1].first == -1) {
        gr[s][b + 1].first = gr[s][b].first;
        gr[s][b + 1].second = gr[s][b].second + 1;
        q.push({s, b + 1});
      }
      if (b - 1 >= 0 && gr[s][b - 1].first == -1) {
        gr[s][b - 1].first = gr[s][b].first + 1;
        gr[s][b - 1].second = gr[s][b].second;
        q.push({s, b - 1});
      }
    }
  }
}
int main() {
  int n, m, r, c, x, y;
  cin >> n >> m >> r >> c >> x >> y;
  r--;
  c--;
  vector<vector<pair<int, int> > > gr(n, vector<pair<int, int> >(m, {-1, -1}));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char ch;
      cin >> ch;
      if (ch == '*') gr[i][j] = {-2, -2};
    }
  }
  bfs(gr, r, c);
  int num = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (gr[i][j].first >= 0 && gr[i][j].second >= 0 && gr[i][j].first <= x &&
          gr[i][j].second <= y)
        num++;
    }
  }
  cout << num << endl;
  return 0;
}
