#include <bits/stdc++.h>
#define ll long long
using namespace std;
//reverse(s.begin(),s.end())
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
int main(){
	int n,m;
	cin>>n>>m;
	int x,y;
	cin>>x>>y;
	char mz[n+1][m+1];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>mz[i][j]; 
		}
	}
	int ans=1;
	int tx=x;
	int ty=y;
	while(mz[tx+1][y]=='.'){
		ans++;
		tx++;
	}
	tx=x;
	while(mz[tx-1][y]=='.'){
		ans++;
		tx--;
	}
	ty=y;
	while(mz[x][ty+1]=='.'){
		ans++;
		ty++;
	}
	ty=y;
	while(mz[x][ty-1]=='.'){
		ans++;
		ty--;
	}
	cout<<ans;
}

#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>

using namespace std;

using ll = long long;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define f first
#define s second
#define pb push_back

// clang-format off
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T_vector>void output_vector(const T_vector &v, bool add_one = false, int start = -1, int end = -1) {if (start < 0) start = 0; if (end < 0) end = int(v.size()); for (int i = start; i < end; i++) cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n');}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << "(" << v.first << ":" << v.second << ")" << ","; os << "}"; return os; }


auto random_address = [] {char *p = new char; delete p;return uint64_t(p);};
const uint64_t SEED = chrono::steady_clock::now().time_since_epoch().count() * (random_address() | 1);
mt19937_64 rng(SEED);
// clang-format on

void solve() { }

int main() {
     ios::sync_with_stdio(0);
     cin.tie(0);
     int m, n, x, y;
     cin >> m >> n >> x >> y;

     string mat[m];
     for (int i = 0; i < m; i++) {
          cin >> mat[i];
     }
     int ans = 0;
     --x;
     --y;
     int t1 = x, t2 = y, t3 = x, t4 = y;
     while (t1 + 1 < m) {
          if (mat[t1 + 1][y] == '#')
               break;
          else if (mat[t1 + 1][y] == '.') {
               ans++;
          }
          t1++;
     }
     while (t2 + 1 < n) {
          if (mat[x][t2 + 1] == '#')
               break;
          else if (mat[x][t2 + 1] == '.') {
               ans++;
          }
          t2++;
     }
     while (t3 - 1 >= 0) {
          if (mat[t3 - 1][y] == '#')
               break;
          else if (mat[t3 - 1][y] == '.') {
               ans++;
          }
          t3--;
     }
     while (t4 - 1 >= 0) {
          if (mat[x][t4 - 1] == '#')
               break;
          else if (mat[x][t4 - 1] == '.') {
               ans++;
          }
          t4--;
     }
     cout << ans + 1;
}
