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

/*------------------------------------------------------------------*/

#define ll long long int
#define mp make_pair
#define pb push_back
#define MOD 998244353

bool isvowel(char c)
{
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return true;
        return false;
}
ll isprime(ll n)
{
    ll ans=1;
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return 0;
    }
    return 1;
}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    if(b==1)
        return a%m;
    ll temp=power(a,b/2,m);
    if(b%2==0)
        return ((temp%m)*(temp%m))%m;
    else
        return ((((temp%m)*(temp%m))%m)*a%m)%m;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void ncrinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}



long long ncr(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll c(ll n, ll k)
{
    ll i, j;
      ll C[n + 1][k + 1];
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {

            if (j == 0 || j == i)
                C[i][j] = 1;

            else
                C[i][j] = (C[i - 1][j - 1]%MOD +
                          C[i - 1][j]%MOD)%MOD;
        }
    }
    return C[n][k]%MOD;
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {

        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;


        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans = (ans%MOD * i%MOD)%MOD;
    }
    return ans;
}
/*-----------------------------------------------------------------------------*/
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    //freopen("1.txt","rt",stdin);
    //freopen("output.txt","wwt",stdout);

    ll t;
    t=1;
    //cin>>t;
    //ll t1=0;
    ll t1=0;
    while(t--)
    {
        ll h,w,x,y;
        cin>>h>>w>>x>>y;
        x--;
        y--;
        string s[h];
        for(ll i=0;i<h;i++)
         cin>>s[i];
        ll cnt=1; 
        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; 
        }
        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; 
        }
        cout<<cnt<<endl;
    }
}
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w,x,y;
    char s[110][110];
    cin >> h >> w >> y >> x;
    int count = 1;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w;j++){
            cin >> s[i][j];//問題文の通りに入力されてる
        }
    }
    for(int i = y;i >= 1;i--){ //同じ列でy~0まで調べる
        if( s[i][x] == '.' )count++;
        else{
            break;
        }
    }
    for(int i = y;i <= h;i++){ //同じ列をy~hまで調べる
        if(s[i][x] == '.')count++;
        else{
            break;
        }
    }
    for(int i = x;i >= 1;i--){ //同じ行をx~0まで調べる
        if(s[y][i] == '.')count++;
        else{
            break;
        }
    }
    for(int i = x;i <= w;i++){
        if(s[y][i] == '.')count++;
        else{
            break;
        }
    }
    cout << count - 4 << endl;


}