#include<bits/stdc++.h>
using namespace std;
int main()
{
    char arr[101][101];
    int i,n,m,x,y,count=0;
    char ch;
    cin>>n>>m>>x>>y;
    for(i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>arr[i][j];
        }
    }
    if(arr[x][y]=='.')
        count++;
    else if(arr[x][y]=='#')
    {
        cout<<"0"<<endl;
        return 0;
    }
    for(i=x+1;i<=n;i++)
    {
        if(arr[i][y]=='.')
            count++;
        else
            break;
    }
    for(i=x-1;i>=1;i--)
    {
        if(arr[i][y]=='.')
            count++;
        else
            break;
    }
    for(i=y+1;i<=m;i++)
    {
        if(arr[x][i]=='.')
            count++;
        else
            break;
    }
    for(i=y-1;i>=1;i--)
    {
        if(arr[x][i]=='.')
            count++;
        else
            break;
    }
    cout<<count<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int h, w, x, y;
    cin >> h >> w >> x >> y;
    x--;
    y--;
    vector<string> mp(h);
    for (int i = 0; i < h; i++) cin >> mp[i];
    int ans = 0;
    for (int i = x; i < h; i++) {
        if (mp[i][y] == '#') break;
        ans++;
    }
    for (int i = x - 1; i >= 0; i--) {
        if (mp[i][y] == '#') break;
        ans++;
    }
    for (int j = y + 1; j < w; j++) {
        if (mp[x][j] == '#') break;
        ans++;
    }
    for (int j = y - 1; j >= 0; j--) {
        if (mp[x][j] == '#') break;
        ans++;
    }
    cout << ans << endl;

    return 0;
}
