#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool cmax(T &a, T b) {
  return (a < b) ? a = b, 1 : 0;
}
template <typename T>
bool cmin(T &a, T b) {
  return (a > b) ? a = b, 1 : 0;
}
template <typename T>
T read() {
  T ans = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch))
    ans = (ans << 3) + (ans << 1) + (ch - '0'), ch = getchar();
  return ans * f;
}
template <typename T>
void write(T x, char y) {
  if (x == 0) {
    putchar('0'), putchar(y);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  static char wr[20];
  int top = 0;
  for (; x; x /= 10) wr[++top] = x % 10 + '0';
  while (top) putchar(wr[top--]);
  putchar(y);
}
void file() {}
const int N = 2e3 + 5;
int n, m;
int r, c;
int L, R;
char mp[N][N];
void input() {
  n = read<int>(), m = read<int>();
  r = read<int>(), c = read<int>();
  L = read<int>(), R = read<int>();
  for (register int i = (int)(1); i <= (int)(n); ++i) scanf("%s", mp[i] + 1);
}
int dis[N][N];
int dx[4] = {0, -1, 1, 0}, dy[4] = {-1, 0, 0, 1};
deque<pair<int, int> > q;
void work() {
  int t1, t2;
  memset(dis, 0x3f3f3f3f, sizeof dis);
  dis[r][c] = 0;
  q.push_back(make_pair(r, c));
  pair<int, int> now;
  while (!q.empty()) {
    now = q.front(), q.pop_front();
    for (register int i = (int)(0); i <= (int)(3); ++i) {
      t1 = now.first + dx[i], t2 = now.second + dy[i];
      if (t1 >= 1 && t2 >= 1 && t1 <= n && t2 <= m && mp[t1][t2] != '*') {
        if (cmin(dis[t1][t2], dis[now.first][now.second] + (i == 0))) {
          if (i == 0)
            q.push_back(make_pair(t1, t2));
          else
            q.push_front(make_pair(t1, t2));
        }
      }
    }
  }
  int cnt = 0;
  for (register int i = (int)(1); i <= (int)(n); ++i)
    for (register int j = (int)(1); j <= (int)(m); ++j) {
      if (dis[i][j] <= L) {
        int pos = c - dis[i][j];
        if (j - pos <= R) cnt++;
      }
    }
  write(cnt, '\n');
}
int main() {
  file();
  input();
  work();
  return 0;
}
