#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll H, W, X, Y;
    cin >> H >> W >> X >> Y;
    --X; --Y;
    vector<string> S(H);
    REP(i,0,H) cin >> S[i];

    ll cnt = 1;
    for(ll i=Y+1; i<W; ++i) {
        if(S[X][i] == '.') ++cnt;
        else break;
    }
    for(ll i=Y-1; i>=0; --i) {
        if(S[X][i] == '.') ++cnt;
        else break;
    }
    for(ll i=X+1; i<H; ++i) {
        if(S[i][Y] == '.') ++cnt;
        else break;
    }
    for(ll i=X-1; i>=0; --i) {
        if(S[i][Y] == '.') ++cnt;
        else break;
    }
    PR(cnt);

    return 0;
}

/*



*/
#include <bits/stdc++.h>
using namespace std;

int main() {
 int H,W,X,Y;
  cin >>H>>W>>X>>Y;
  vector<vector<char>> s(H, vector<char>(W));
  
  for (int i = 0; i < H; i++) {
    // i番目の状態を読む
    for (int j = 0; j < W; j++) {
        cin >> s.at(i).at(j);
      }
    }
  

  int count_t = 0;
  int count_y =0;

//縦で考える
  for(int i=0;i<H;i++){
    
  	if(s.at(i).at(Y-1)=='#'&&X-1>i)
      count_t=0;
    else if(s.at(i).at(Y-1)=='#'&&X-1<=i)
      break;
    else if(s.at(i).at(Y-1)=='.')
      count_t++;
  }
  
  //横で考える
  for(int j=0;j<W;j++){
    
  	if(s.at(X-1).at(j)=='#'&&Y-1>j)
      count_y=0;
    else if(s.at(X-1).at(j)=='#'&&Y-1<=j)
      break;
    else if(s.at(X-1).at(j)=='.')
      count_y++;
  }
  cout<<count_t+count_y-1<<endl;
}
