#include <bits/stdc++.h>
using namespace std;
const int N = 2100;
char mp[N][N];
int n, m, lp, rp, dis[N][N];
bool vis[N][N];
struct poi {
  int x, y;
} q[N * N], st;
void expan(int x, int y, int di) {
  int i;
  for (i = x; mp[i][y] != '*'; i--) {
    q[++rp] = (poi){i, y};
    dis[i][y] = di;
    vis[i][y] = 1;
  }
  for (i = x + 1; mp[i][y] != '*'; i++) {
    q[++rp] = (poi){i, y};
    dis[i][y] = di;
    vis[i][y] = 1;
  }
}
int main() {
  int i, j, k, le, ri, x, y;
  scanf("%d%d%d%d%d%d", &n, &m, &st.x, &st.y, &le, &ri);
  for (i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
  for (i = 0; i <= m + 1; i++) mp[0][i] = mp[n + 1][i] = '*';
  for (i = 0; i <= n + 1; i++) mp[i][0] = mp[i][m + 1] = '*';
  lp = 1;
  rp = 0;
  expan(st.x, st.y, 0);
  while (lp <= rp) {
    poi now = q[lp++];
    x = now.x;
    y = now.y;
    if ((!vis[x][y - 1]) && (mp[x][y - 1] != '*'))
      expan(x, y - 1, dis[x][y] + 1);
    if ((!vis[x][y + 1]) && (mp[x][y + 1] != '*'))
      expan(x, y + 1, dis[x][y] + 1);
  }
  int ans = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      int fix = st.y - j;
      if ((vis[i][j]) && (mp[i][j] != '*') &&
          (le >= ((dis[i][j] + fix) >> 1)) && (ri >= ((dis[i][j] - fix) >> 1)))
        ans++;
    }
  printf("%d\n", ans);
  return 0;
}
