#include<bits/stdc++.h>
using namespace std;
const int N=1e8;
int h,w,x,y;
char s[110][110];
int main()
{
    int sum=1;
    cin>>h>>w>>x>>y;
    y--;
    for(int i=1;i<=h;i++)
        cin>>s[i];
    for(int i=x+1;i<=h;i++)
        if(s[i][y]=='.')
            sum++;
        else break;
    for(int i=x-1;i>=1;i--)
        if(s[i][y]=='.')
            sum++;
        else break;
    for(int i=y+1;i<w;i++)
        if(s[x][i]=='.')
            sum++;
        else break;
    for(int i=y-1;i>=0;i--)
        if(s[x][i]=='.')
            sum++;
        else break;
    cout<<sum;
    return 0;
}

#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
constexpr ll MOD = 1000000007;
 
#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
ostream &operator<<(ostream &o, const string &obj) {o << "\""; o << obj.c_str(); o << "\""; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}

#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif

template <typename... Ts>
std::istream& IN(Ts&... xs){ return (std::cin >> ... >> xs); }

#define repr(i, a, b) for (ll i = a; i < b; i++)
#define rep(i, n) for (ll i = 0; i < n; i++)



int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll h,w,x,y;
    IN(h,w,x,y);

    x--; y--;

    vector<vector<ll>> m(h,vector<ll>(w,0));

    rep(i,h){
        string s;
        cin >> s;
        rep(j,w){
            m[i][j] = (s[j] == '#');
        }
    }

    print(m, x,y)

    auto count_ok = [&](ll step_x, ll step_y){
        ll i,j;
        i = y+step_y; j=x+step_x;
        ll res = 0;
        print(i,j)
        while(0 <= j && j < h &&
              0 <= i && i < w){
                  if(m[j][i] != 0){
                      break;
                  }
                  print(i,j,res)
                  res++;
                  i += step_y;
                  j += step_x;
              }
        return res;
    };

    ll ans = (m[x][y] == 0);


    ans += count_ok(1,0);
    ans += count_ok(0,1);
    ans += count_ok(-1,0);
    ans += count_ok(0,-1);


    cout << ans << endl;
 
    return 0;
}

