#include <bits/stdc++.h>
#define int long long
using namespace std;

inline int read(){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s*w;
}

inline bool read(int& a){
    int s=0,w=1;
    char ch=getchar();
    if(ch==EOF){
        return false;
    }
    while(ch<'0'||ch>'9'){
        if(ch=='-')w=-1;ch=getchar();
    }
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    a=s*w;
    return true;
}

inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

template<typename...args>inline bool read(int &a,args&...x){
    return (read(a),read(x...));
}

inline void writeln(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
    puts("");
}

int h,w,x,y;
char m[110][110];

bool in(int x,int y){
    return x>=1&&x<=h&&y>=1&&y<=w;
}

int ans=1;

signed main(){
    read(h,w,x,y);

    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>m[i][j];
        }
    }

    for(int i=1;i<=h;i++){
        if(in(x+i,y)&&m[x+i][y]!='#'){
            ans++;
        }
        else{
            break;
        }
    }

    for(int i=1;i<=h;i++){
        if(in(x-i,y)&&m[x-i][y]!='#'){
            ans++;
        }
        else{
            break;
        }
    }

    for(int i=1;i<=w;i++){
        if(in(x,y+i)&&m[x][y+i]!='#'){
            ans++;
        }
        else{
            break;
        }
    }

    for(int i=1;i<=w;i++){
        if(in(x,y-i)&&m[x][y-i]!='#'){
            ans++;
        }
        else{
            break;
        }
    }

    writeln(ans);

    return 0;
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(ll i=ll(m); i<ll(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<ll,ll>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }

const int  INF = (1 << 30) - 1;
const ll INFL = 1LL << 61;
const ll mod =998244353;


vector<int> dx = { 1,-1, 0, 0, 1,-1,-1, 1 };
vector<int> dy = { 0, 0, 1,-1, 1,-1, 1,-1 };
int h, w;
bool isinside(int i, int j) {
	if (0 <= i && i < h && 0 <= j && j < w) {
		return true;
	}
	return false;
}

int main() {

	
	cin >> h >> w;
	int i, j;
	cin >> i >> j;
	i--, j--;
	VS v(h);
	REP(i, h)cin >> v[i];

	int cnt = 0;
	
	REP(k, 4) {
		int a = 0;
		while (true) {
			int ny = i + dy[k] * a;
			int nx = j + dx[k] * a;
			if (!isinside(ny, nx))break;
			if (v[ny][nx] == '#')break;
			a++;
		}
		cnt += a;
	}
	cout << cnt-3 << endl;



}