#include <bits/stdc++.h>   const int MAXN = 2000 + 10;   const int INF = std::numeric_limits<int>::max();   const double EPS = 1e-6;   const int dx[] = {1, 0, -1, 0};   const int dy[] = {0, 1, 0, -1};   int a[MAXN][MAXN];   std::deque<std::pair<std::pair<int, int>, int>> q;   using std::cin;   using std::cout;   using std::endl;   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(0);     std::cout.tie(0);     int n, m;     cin >> n >> m;     int r, c;     cin >> r >> c;     int x, y;     cin >> x >> y;     for (int i = 0; i <= n + 1; ++i) {       for (int j = 0; j <= m + 1; ++j) {         a[i][j] = -1;       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         char c;         cin >> c;         if (c ==  . ) a[i][j] = INF;       }     }     q.push_back({{r, c}, 0});     a[r][c] = 0;     while (!q.empty()) {       int cur_x = q.front().first.first, cur_y = q.front().first.second,           cur_step = q.front().second;       q.pop_front();       for (int i = 0; i < 4; ++i) {         if (a[cur_x + dx[i]][cur_y + dy[i]] > cur_step + (dy[i] == -1)) {           a[cur_x + dx[i]][cur_y + dy[i]] = cur_step + (dy[i] == -1);           if (dy[i] == -1)             q.push_back({{cur_x + dx[i], cur_y + dy[i]}, cur_step + 1});           else             q.push_front({{cur_x + dx[i], cur_y + dy[i]}, cur_step});         }       }     }     int ans = 0;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         if (a[i][j] != -1) {           if (a[i][j] <= x && a[i][j] + j - c <= y) {             ++ans;           }         }       }     }     cout << ans << endl;     return 0;   }   