#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
    int ans = a*d - b*c;
	cout << ans << "\n";
	return 0;
}

#include <bits/stdc++.h>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法
#define MOD2 1000007
#define MOD3 998244353

using namespace std;
typedef long long ll;

/*
0のアスキー　"48"
*/

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) x.begin(),x.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

typedef std::priority_queue<ll> LLPrioQueue;
typedef std::priority_queue<ll, std::vector<ll> , std::greater<ll> > LLReversePrioQueue;

int main(){

    int H,W;
    cin >> H >> W;
    int h,w;
    cin >>h >> w;
    h--;
    w--;
    vector<string> A(H);
    for(ll i = 0;i < H;i++)
        cin >> A.at(i);
    ll res = 0;
    if(A.at(h).at(w) == '.')
        res++;
    
    for(ll i = w-1;i >= 0;i--){
        if(A.at(h).at(i) == '.')
            res++;
        else
            break;
    }

    for(ll i = h -1;i >= 0;i--){
        if(A.at(i).at(w) == '.')
            res++;
        else
            break;
    }

    for(ll i = h + 1;i < H;i++){
        if(A.at(i).at(w) == '.')
            res++;
        else
            break;
    }

    for(ll i = w + 1;i < W;i++){
        if(A.at(h).at(i) == '.')
            res++;
        else
            break;
    }

    cout << res << endl;

    return 0;
}