#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b)     for(int i=a;i>=b;--i)
#define init(a, x) memset(a,x,sizeof(a))
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
        cin>>a>>b>>n>>m;;
        string s[a];
        for(int i=0;i<a;i++)
            cin>>s[i];
        ll ans =1;
        int cnt = 0;
        for(int i=m;i<b;i++)
        {
            if(s[n-1][i]=='.')
                cnt++;
            else
                break;
        }
        // ans += (cnt*(cnt-1))/2;
        ans += cnt;
        cnt =0;
        for(int i=m-2;i>=0;i--)
        {
            if(s[n-1][i]=='.')
                cnt++;
            else
                break;
        }
        ans += cnt;
        cnt = 0;
        for(int i=n;i<a;i++)
        {
            if(s[i][m-1]=='.')
                cnt++;
            else
                break;
        }
        ans += cnt;
        cnt =0;
        for(int i=n-2;i>=0;i--)
        {
            if(s[i][m-1]=='.')
                cnt++;
            else
                break;
        }
        ans += cnt;
        // ans += (cnt*(cnt-1))/2;
        cout<<ans<<endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
using pint = pair<ll, ll>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {
    int h, w, x, y;
    cin >> h >> w >> x >> y;
    vector<string> s(h);
    rep(i, 0, h) cin >> s[i];
    int cnt = 0;
    rep(i, x - 1, h) {
        if (s[i][y - 1] == '#') break;
        cnt++;
    }
    per(i, 0, x - 1) {
        if (s[i][y - 1] == '#') break;
        cnt++;
    }
    rep(i, y, w) {
        if (s[x - 1][i] == '#') break;
        cnt++;
    }
    per(i, 0, y - 1) {
        if (s[x - 1][i] == '#') break;
        cnt++;
    }
    cout << cnt << "\n";
}