#include<bits/stdc++.h>
#include <iterator>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define pdd pair<dd,dd>
#define read_arr(a,n) for(ll i=1;i<=n;i++)cin>>a[i];
#define init_arr(a,n) for(ll i=1;i<=n;i++)a[i]=n-i+1;
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
#define arr array 
using namespace std;
ll h,w,a,b;
ll ans=0;
void dfs(ll index,ll mask,ll lef_a,ll lef_b){
	
	if(index == h*w){
		ans++;
		return;
	}

	if(mask & (1ll<<index)){
		dfs(index+1,mask,lef_a,lef_b);
		return ;
	}

	if(lef_b){
		dfs(index+1,mask | 1<<index ,lef_a,lef_b-1);
	}

	if(lef_a){
		if(index%w +1 <w and (mask & (1ll<<(index+1)))==0){
			dfs(index+1,mask | (1ll<<index) | (1ll<< (index+1) ) ,lef_a-1,lef_b);
		}

		if(index+w<h*w ){
			dfs(index+1,mask | (1ll<<index) | (1ll<<(index+w)),lef_a-1,lef_b);
		} 
	}



}

void solve(){
	cin>>h>>w>>a>>b;
	dfs(0,0,a,b);

	cout<<ans<<endl;
	
}
	

int main(){

	boost;
	ll t=1;
	


	while(t--){
		solve();
	}
	

}
	
	
 
 
 
 


	

	







	
	

	
	




		


    
	


		
#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>
/* find_by_order(x) give iterator of the index x 
   order_by_key(x) give the position where x will be placed*/
#define int long long
#define lop(i,a,b,c) for (int i=a;i<b;i+=c)
#define rlop(i,a,b,c) for (int i=a-1;i>=b;i-=c)
#define prii pair <int,int>
#define PB push_back
#define S second
#define F first
#define all(x) x.begin(),x.end()
#define vvii vector < vector < int > >
#define vii vector <int>
#define count_1(x) __builtin_popcount(x)
#define cn(a) scanf("%lld",&a);
#define cn_vl(arr,n) lop(i,0,n,1){scanf("%lld",arr+i);}
#define shw_vl(arr,n) lop(i,0,n,1){printf("%lld ",arr[i]);}printf("\n");
const int MAX=2e5+10;
/*......................................................................*/
void fastscan(int &number)
{
    bool negative = false;
    register int c;
    number = 0;
    c = getchar();
    if (c=='-')
    {
        negative = true;
        c = getchar();
    }
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;
    if (negative)
        number *= -1;
}
bool cmp(prii a,prii b){
	if (a.F==b.F){
		return a.S<b.S;
	}
	return a.F<b.F;
}
void solve(){
	int n;cin>>n;
	vector <prii> vec1,vec2;
	lop (i,0,n,1){
		int a,b;cn(a)cn(b)
		vec1.PB({a,i});
		vec2.PB({b,i});
	}
	sort(all(vec1));
	sort(all(vec2));
	pair <int,prii> mx1,mx2,mx3,mx4,mx;mx1=mx2=mx3=mx4={-LLONG_MAX,{-1,-1}};
	mx1=max(mx1,{vec2[n-1].F-vec2[0].F,{vec2[n-1].S,vec2[0].S}});
	mx2=max(mx2,{vec1[n-1].F-vec1[0].F,{vec1[n-1].S,vec1[0].S}});
	mx3=max(mx3,{vec2[n-1].F-vec2[1].F,{vec2[n-1].S,vec2[1].S}});
	mx3=max(mx3,{vec2[n-2].F-vec2[0].F,{vec2[n-2].S,vec2[0].S}});
	mx4=max(mx4,{vec1[n-1].F-vec1[1].F,{vec1[n-1].S,vec1[1].S}});
	mx4=max(mx4,{vec1[n-2].F-vec1[0].F,{vec1[n-2].S,vec1[0].S}});
	vector <pair <int,prii> > vec;
	vec.PB(mx1);vec.PB(mx2);vec.PB(mx3);vec.PB(mx4);
	sort(all(vec));
	mx.S=vec[3].S;
	rlop (i,3,0,1){
		if (vec[i].S==mx.S)continue;
		cout<<vec[i].F<<"\n";return;
	}
	// lop (i,1,n,1){
	// 	int z1=max(vec1[i].F-vec1[i-1].F,vec1[i].S-vec1[i-1].S);
	// 	if (z1<mn1){
	// 		cout<<i<<"\n";
	// 		mn2=mn1;
	// 		mn1=z1;
	// 	}
	// 	else if(z1<mn2)mn2=z1;
	// 	cout<<mn2<<" "<<mn1<<" \n";
	// }
	// lop (i,1,n,1){
	// 	int z1=max(vec2[i].F-vec2[i-1].F,vec2[i].S-vec2[i-1].S);
	// 	if (z1<mn1){
	// 		mn2=mn1;
	// 		mn1=z1;
	// 	}
	// 	else if(z1<mn2)mn2=z1;
	// }
}
int32_t main(){
	int t;t=1;
	//cin>>t;
	while (t--){
		solve();
	}
	return 0;
}