#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 2222;
char mat[maxn][maxn];
int main() {
ios_base::sync_with_stdio(false);
int n, m, si, sj, L, R;
cin >> n >> m;
cin >> si >> sj;
cin >> L >> R;
si--; sj--;
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
cin >> mat[i][j];
}
}
vector > dist(n + 1, vector(m + 1, 2e9));
vector > visited(n + 1, vector(m + 1, false));
dist[si][sj] = 0;
deque > dq;
dq.push_back(make_pair(si, sj));
int di[] = {-1, 1, 0, 0};
int dj[] = {0, 0, 1, -1};
while(!dq.empty()) {
int ci = dq.front().first;
int cj = dq.front().second;
dq.pop_front();
if(!visited[ci][cj]) {
visited[ci][cj] = true;
for(int i = 0; i < 4; i++) {
int ti = ci + di[i];
int tj = cj + dj[i];
if(ti >= 0 and ti < n and tj >= 0 and tj < m and mat[ti][tj] != '*') {
int cost = 0;
if(i == 3) {
cost = 1;
}
if(dist[ci][cj] + cost < dist[ti][tj]) {
dist[ti][tj] = dist[ci][cj] + cost;
if(cost == 0) {
dq.push_front(make_pair(ti, tj));
}
else {
dq.push_back(make_pair(ti, tj));
}
}
}
}
}
}
int result = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
if(dist[i][j] < 2e9) {
int l_tmp = dist[i][j];
int r_tmp = j - sj + l_tmp;
if(l_tmp <= L and r_tmp <= R) {
result++;
}
}
}
}
cout << result << endl;
return 0;
}