#include <bits/stdc++.h>
using namespace std;
int main() {
    int H, W, X, Y;
    cin >> H >> W >> X >> Y;
    vector<string> data(H);
    for (int i = 0; i < H; i++){
            cin >> data.at(i);
        }
    int answer = 1;
  
      for (int i = X-2; i >= 0; i--){
        if (data.at(i).at(Y-1) == '#') break;
        else answer += 1;
    }
    for (int i = X; i <= H-1; i++){
        if (data.at(i).at(Y-1) == '#') break;
        else answer += 1;
    }
    for (int i = Y-2; i >= 0; i--){
        if (data.at(X-1).at(i) == '#') break;
        else answer += 1;
    }
    for (int i = Y; i <= W-1; i++){
        if (data.at(X-1).at(i) == '#') break;
        else answer += 1;
    }

    cout << answer << endl;
}
#pragma region

#include <bits/stdc++.h>

#define _GLIBCXX_DEBUG

using namespace std;

using ll = long long;
using ld = long double;
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;

#define all(x) x.begin(), x.end()

#define rep(i, s, e) for(ll i = s; i < e; ++i)
#define repr(i, s, e) for(ll i = s; i > e; --i)

template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void CIN() {}
template<class T, class ...Ts> void CIN(T &&t, Ts &&...ts){ cin >> t; CIN(ts...); }
void COUT() { cout << endl; }
template<class T, class ...Ts> void COUT(T &&t, Ts &&...ts){ cout << t << " "; COUT(ts...); }

#pragma endregion

int dfs(const vector<string> s, const int h, const int w, const int sy, const int sx)
{
    stack<pair<int, int>> d; //directions(y, x)
    d.push(make_pair(1, 0)); //down
    d.push(make_pair(-1, 0)); //up
    d.push(make_pair(0, 1)); //right
    d.push(make_pair(0, -1)); //left
    int res = 0;
    while (!d.empty()){
        int y = sy - 1, x = sx - 1;
        while(1){
            int dir_y = d.top().first, dir_x = d.top().second; d.pop();
            if ((y + dir_y < 0) || (h <= y + dir_y) || (x + dir_x < 0) || (w <= x + dir_x)) break;
            else {
                if (s[y + dir_y][x + dir_x] == '.') {
                    d.push(make_pair(dir_y, dir_x));
                    x += dir_x;
                    y += dir_y;
                    res ++;
                } else break;
            }
        }
    }
    return res;
}

int main()
{
    cin.tie(nullptr);
    int h, w, sy, sx; CIN(h, w, sy, sx);
    vector<string> s(h);
    for (auto &in :s) cin >> in;
    cout << dfs(s, h, w, sy, sx) + 1 << endl;
    return 0;
}
