

#include <bits/stdc++.h>

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e9+7;

ll ceildiv(ll a, ll b) { return (a+b-1)/b; } // 切り上げ
ll floordiv(ll a, ll b) { return a/b; } // 切り下げ

int show_matrix(vector<vector<int>> &dp) {
  loop(0, dp.size(), i) {
    loop(0, dp[i].size(), j) {
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

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

  ll H, W, X, Y;
  cin >> H >> W >> X >> Y;
  X--; Y--;
  vector<vector<ll>> M(H, vector<ll>(W));

  loop(0, H, i) {
    string s;
    cin >> s;
    loop(0, W, j) {
      if (s[j] == '#') {
        M[i][j] = 1;
      }
    }
  }

  ll count = 0;
    for (int i=Y; i >= 0; i--) {
      if (M[X][i] == 1) {
        break;
      } else {
        count++;
      }
    }

    for (int i=Y; i < W; i++) {
      if (M[X][i] == 1) {
        break;
      } else {
        count++;
      }
    }

    for (int i=X; i >= 0; i--) {
      if (M[i][Y] == 1) {
        break;
      } else {
        count++;
      }
    }

    for (int i=X; i < H; i++) {
      if (M[i][Y] == 1) {
        break;
      } else {
        count++;
      }
    }
  print(count - 3);
}

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <string>
#include <math.h>
#include <functional>
#include <iomanip>
#include <set>
#include <map>
#include <numeric>
#include <cstdint>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

using ll = long long;

template <ll ModVal>
struct ModInt {
    ll x;

    ModInt(ll _x = 0) : x((_x% ModVal + ModVal) % ModVal) {
    }

    ModInt operator-() const {
        return ModInt(-x);
    }
    ModInt& operator+=(const ModInt a) {
        x += a.x;
        if (x >= ModVal)
            x -= ModVal;
        return *this;
    }
    ModInt& operator-=(const ModInt a) {
        x = x + ModVal - a.x;
        if (x >= ModVal)
            x -= ModVal;
        return *this;
    }
    ModInt& operator*=(const ModInt a) {
        x *= a.x;
        x %= ModVal;
        return *this;
    }

    ll ext_gcd(ll a, ll b, ll& x, ll& y) {
        if (b == 0) {
            x = 1;
            y = 0;
            return a;
        }
        ll tmp = a / b;
        ll d = ext_gcd(b, a - b * tmp, y, x);
        y -= tmp * x;
        return d;
    }

    // 逆元
    ModInt inv(const ModInt a) {
        ll u, v;
        ext_gcd(a.x, ModVal, u, v);
        return ModInt(u);
    }

    ModInt& operator/=(const ModInt a) {
        return (*this) *= inv(a);
    }

    ModInt operator+(const ModInt a) const {
        ModInt retval(*this);
        return retval += a;
    }
    ModInt operator-(const ModInt a) const {
        ModInt retval(*this);
        return retval -= a;
    }
    ModInt operator*(const ModInt a) const {
        ModInt retval(*this);
        return retval *= a;
    }
    ModInt operator/(const ModInt a) const {
        ModInt retval(*this);
        return retval /= a;
    }

    ModInt pow(ll n) {
        ModInt ans(1);
        while (n) {
            if (n & 1)
                ans = ans * x;
            *this = (*this) * (*this);
            n = n >> 1;
        }
        return ans;
    }

    constexpr const ll& value() {
        return this->x;
    }
};

template <ll ModVal>
ostream& operator<<(ostream & os, const ModInt<ModVal>&a) {
    os << a.x;
    return os;
}

#define mod (ll)(1e9 + 7)
using mint = ModInt<mod>;


int main(){
    int H,W;cin>>H>>W;
    int X,Y;cin>>X>>Y;
    vector<string> m(H);
    for (int i = 0; i < H; i++) {
        cin>>m[i];
    }
    X-=1;Y-=1;
    int ans = 0;
    for (int i = 1; i+X < H; i++) {
        if (m[i + X][Y] == '#') {
            break;
        }
        if (m[i + X][Y] == '.') {
            ans++;
        }
    }
    for (int i = 1; -i+X >=0; i++) {
        if (m[-i + X][Y] == '#') {
            break;
        }
        if (m[-i + X][Y]=='.') {
            ans++;
        }
    }
    for (int i = 1; i+Y < W; i++) {
        if (m[X][Y + i] == '#') {
            break;
        }
        if (m[X][Y + i] == '.') {
            ans++;
        }
    }
    for (int i = 1; -i+Y >=0; i++) {
        if (m[X][Y - i] == '#') {
            break;
        }
        if (m[X][Y - i] == '.') {
            ans++;
        }
    }
    ans++;
    cout<<ans;
}