#include<iostream> 
#include <cassert>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
using namespace std;

const int N = 3e5 + 123;

char a[200][200];
int n, m, x, y;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m >> x >> y;

	for(int i = 1; i <= n; i++)
	for(int j = 1; j <= m; j++)
		cin >> a[i][j];

	int ux = x;
	while(ux - 1 > 0 && a[ux - 1][y] == '.') ux--;
	int dx = x;
	while(dx + 1 > 0 && a[dx + 1][y] == '.') dx++;
	int ly = y;
	while(ly - 1 > 0 && a[x][ly - 1] == '.') ly--;
	int ry = y;
	while(ry + 1 > 0 && a[x][ry + 1] == '.') ry++;
	cout << ry - ly + 1 + dx - ux + 1 - 1;
	return 0; 
}


















#include<bits/stdc++.h>
#define inf 1e18
#define endl "\n"
#define mp make_pair
#define pb push_back
#define loop(i,x,y) for(int i = x; i < y ; i++ )
#define all(x) (x).begin(),(x).end()
#define in(n)       int n; cin>>n;
#define inarr(arr,n) vector<int>arr(n); for(int i = 0; i < n ; i++){cin>>arr[i];}
#define maploop(x) for(auto itr = x.begin(); itr != x.end();itr++)
#define int long long
using namespace std;
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x<<" "; _print(x); cerr << endl;
#else
#define debug(x);
#endif

void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(double t) {cerr << t;}


template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------*/


const int N = 10001;
int mod = 1000000007;

void Main()
{
	in(h)
	in(w)
	in(x)
	in(y)
	char arr[h][w];
	loop(i, 0, h)
	{
		loop(j, 0, w)
		{

			cin >> arr[i][j];
			//cout << arr[i][j];
		}
		//cout << endl;
	}
	int cnt = 1;
	loop(i, x, h)
	{
		if (arr[i][y - 1] != '.')
			break;
		cnt++;

	}
	//cout << cnt << endl;
	for (int i = x - 2; i >= 0 ; i--)
	{
		if (arr[i][y - 1] != '.')
			break;
		cnt++;

	}
	// loop(i, 0, h)
	// {
	// 	loop(j, 0, w)
	// 	{

	// 		//cin >> arr[i][j];
	// 		cout << arr[i][j];
	// 	}
	// 	cout << endl;
	// }
	// cout << cnt << endl;
	loop(i, y, w)
	{
		//cout << x - 1 << " " << i << endl;
		//cout << arr[x - 1][i] << endl;
		if (arr[x - 1][i] != '.')
			break;
		//cout << "wd" << endl;
		cnt++;
	}
	//cout << cnt << endl;
	for (int i = y - 2; i >= 0 ; i--)
	{

		if (arr[x - 1][i] != '.')
			break;
		cnt++;

	}
	cout << cnt << endl;
}

int32_t main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;
	//cin >> t;
	while (t--)
	{
		Main();
	}
}
