#include <bits/stdc++.h>   using namespace std;   const int N = 2005;   vector<pair<int, int> > v[N * N];   bool flag[N * N], a[N][N], vis[N][N];   pair<int, int> dis[N * N];   int id[N][N], q[N * N], ID, n, m, r, c, sx, sy, ans;   char s[N];   void bfs(int r, int c) {     int L = 0, R = 0;     q[R++] = id[r][c];     flag[id[r][c]] = true;     dis[id[r][c]] = make_pair(0, 0);     while (L < R) {       int u = q[L++], sz = v[u].size();       for (int i = 0; i < sz; i++) {         int x = v[u][i].first, y = v[u][i].second;         if (y > 1 && a[x][y - 1] && !flag[id[x][y - 1]]) {           q[R++] = id[x][y - 1];           flag[id[x][y - 1]] = true;           dis[id[x][y - 1]] = make_pair(dis[u].first + 1, dis[u].second);         }         if (y < m && a[x][y + 1] && !flag[id[x][y + 1]]) {           q[R++] = id[x][y + 1];           flag[id[x][y + 1]] = true;           dis[id[x][y + 1]] = make_pair(dis[u].first, dis[u].second + 1);         }       }     }   }   void dfs(int x, int y, int z) {     vis[x][y] = true;     id[x][y] = z;     v[z].push_back(make_pair(x, y));     if (x > 1 && a[x - 1][y] && !vis[x - 1][y]) dfs(x - 1, y, z);     if (x < n && a[x + 1][y] && !vis[x + 1][y]) dfs(x + 1, y, z);   }   int main() {     memset(dis, 0x3f, sizeof(dis));     scanf( %d%d%d%d%d%d , &n, &m, &r, &c, &sx, &sy);     for (int i = 1; i <= n; i++) {       scanf( %s , s + 1);       for (int j = 1; j <= m; j++) a[i][j] = (s[j] ==  . );     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (a[i][j] && !vis[i][j]) ID++, dfs(i, j, ID);     bfs(r, c);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (a[i][j]) {           int u = id[i][j];           if (dis[u].first <= sx && dis[u].second <= sy) ans++;         }     printf( %d n , ans);     return 0;   }   