#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> edge;
int cost[2005][2005], parent[100005], n, m;
bool vis[2005][2005];
char arr[2005][2005];
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int xx[2005][2005], yy[2005][2005];
void BFS(int x, int y) {
  deque<pair<int, int>> q;
  q.push_back(make_pair(x, y));
  cost[x][y] = 0;
  vis[x][y] = 1;
  while (!q.empty()) {
    auto node = q.front();
    q.pop_front();
    for (int i = 0; i < 4; i++) {
      int newx = node.first + dx[i];
      int newy = node.second + dy[i];
      if (newx >= n || newx < 0 || newy >= m || newy < 0 ||
          arr[newx][newy] == '*')
        continue;
      if (!vis[newx][newy]) {
        vis[newx][newy] = 1;
        if (i < 2) {
          q.push_front(make_pair(newx, newy));
          yy[newx][newy] += yy[node.first][node.second];
          xx[newx][newy] += xx[node.first][node.second];
        } else {
          if (i == 2)
            yy[newx][newy]++;
          else if (i == 3)
            xx[newx][newy]++;
          q.push_back(make_pair(newx, newy));
          yy[newx][newy] += yy[node.first][node.second];
          xx[newx][newy] += xx[node.first][node.second];
        }
      }
    }
  }
}
int main() {
  memset(cost, -1, sizeof cost);
  cin >> n >> m;
  int a, b, x1, y1;
  cin >> a >> b >> x1 >> y1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
    }
  }
  BFS(a - 1, b - 1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (yy[i][j] <= y1 && xx[i][j] <= x1 && arr[i][j] != '*' && vis[i][j])
        arr[i][j] = '+';
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == '+') ans++;
    }
  }
  cout << ans;
  return 0;
}
