#include <bits/stdc++.h>
using namespace std;
const int NN = 2005;
struct node {
  int x, y, a, b;
  node(int X = 0, int Y = 0, int A = 0, int B = 0) {
    x = X, y = Y, a = A, b = B;
  }
} q[NN * NN];
int n, m, sx, sy, le, ri, hed, tal;
bool vis[NN][NN];
bool rd() {
  char c = getchar();
  while (c != '.' && c != '*') c = getchar();
  return c == '*';
}
void put(int x, int y, int a, int b) {
  if (x < 1 || x > n || y < 1 || y > m || vis[x][y])
    return;
  else
    vis[x][y] = 1, q[++tal] = node(x, y, a, b);
  for (int i = (x + 1); i <= (n); i++)
    if (!vis[i][y])
      vis[i][y] = 1, q[++tal] = node(i, y, a, b);
    else
      break;
  for (int i = (x - 1); i >= (1); i--)
    if (!vis[i][y])
      vis[i][y] = 1, q[++tal] = node(i, y, a, b);
    else
      break;
}
int main() {
  scanf("%d%d%d%d%d%d", &n, &m, &sx, &sy, &le, &ri);
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) vis[i][j] = rd();
  put(sx, sy, le, ri);
  while (hed != tal) {
    hed++;
    int x = q[hed].x, y = q[hed].y, a = q[hed].a, b = q[hed].b;
    put(x - 1, y, a, b);
    if (a) put(x, y - 1, a - 1, b);
    put(x + 1, y, a, b);
    if (b) put(x, y + 1, a, b - 1);
  }
  printf("%d\n", tal);
  return 0;
}
