#include <iostream>
using namespace std;
int main() {
int h, w, x, y;
cin >> h >> w >> x >> y;
char grid[h][w];
// Input the grid
for(int i = 0; i < h; i++) {
for(int j = 0; j < w; j++) {
cin >> grid[i][j];
}
}
// Convert (x, y) to 0-indexed
x--;
y--;
int a = 0; // Start with 0, will count the starting point separately
// If the starting point is '.', count it as well
if (grid[x][y] == '.') {
a++;
}
// Check to the right of (x, y)
int n = y + 1;
while (n < w && grid[x][n] == '.') {
a++;
n++;
}
// Check to the left of (x, y)
n = y - 1;
while (n >= 0 && grid[x][n] == '.') {
a++;
n--;
}
// Check below (x, y)
int m = x + 1;
while (m < h && grid[m][y] == '.') {
a++;
m++;
}
// Check above (x, y)
m = x - 1;
while (m >= 0 && grid[m][y] == '.') {
a++;
m--;
}
// Output the result
cout << a;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBpbnQgaCwgdywgeCwgeTsKICAgIGNpbiA+PiBoID4+IHcgPj4geCA+PiB5OwogICAgY2hhciBncmlkW2hdW3ddOwoKICAgIC8vIElucHV0IHRoZSBncmlkCiAgICBmb3IoaW50IGkgPSAwOyBpIDwgaDsgaSsrKSB7CiAgICAgICAgZm9yKGludCBqID0gMDsgaiA8IHc7IGorKykgewogICAgICAgICAgICBjaW4gPj4gZ3JpZFtpXVtqXTsKICAgICAgICB9CiAgICB9CgogICAgLy8gQ29udmVydCAoeCwgeSkgdG8gMC1pbmRleGVkCiAgICB4LS07CiAgICB5LS07CgogICAgaW50IGEgPSAwOyAgLy8gU3RhcnQgd2l0aCAwLCB3aWxsIGNvdW50IHRoZSBzdGFydGluZyBwb2ludCBzZXBhcmF0ZWx5CgogICAgLy8gSWYgdGhlIHN0YXJ0aW5nIHBvaW50IGlzICcuJywgY291bnQgaXQgYXMgd2VsbAogICAgaWYgKGdyaWRbeF1beV0gPT0gJy4nKSB7CiAgICAgICAgYSsrOwogICAgfQoKICAgIC8vIENoZWNrIHRvIHRoZSByaWdodCBvZiAoeCwgeSkKICAgIGludCBuID0geSArIDE7CiAgICB3aGlsZSAobiA8IHcgJiYgZ3JpZFt4XVtuXSA9PSAnLicpIHsKICAgICAgICBhKys7CiAgICAgICAgbisrOwogICAgfQoKICAgIC8vIENoZWNrIHRvIHRoZSBsZWZ0IG9mICh4LCB5KQogICAgbiA9IHkgLSAxOwogICAgd2hpbGUgKG4gPj0gMCAmJiBncmlkW3hdW25dID09ICcuJykgewogICAgICAgIGErKzsKICAgICAgICBuLS07CiAgICB9CgogICAgLy8gQ2hlY2sgYmVsb3cgKHgsIHkpCiAgICBpbnQgbSA9IHggKyAxOwogICAgd2hpbGUgKG0gPCBoICYmIGdyaWRbbV1beV0gPT0gJy4nKSB7CiAgICAgICAgYSsrOwogICAgICAgIG0rKzsKICAgIH0KCiAgICAvLyBDaGVjayBhYm92ZSAoeCwgeSkKICAgIG0gPSB4IC0gMTsKICAgIHdoaWxlIChtID49IDAgJiYgZ3JpZFttXVt5XSA9PSAnLicpIHsKICAgICAgICBhKys7CiAgICAgICAgbS0tOwogICAgfQoKICAgIC8vIE91dHB1dCB0aGUgcmVzdWx0CiAgICBjb3V0IDw8IGE7CgogICAgcmV0dXJuIDA7Cn0K