stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

#define re register

#define ll long long

using namespace std;

inline int read(){

	int k=1,sum=0;

	char c=getchar();

	for(;c<'0' || c>'9';c=getchar()) if(c=='-') k=-1;

	for(;c>='0' && c<='9';c=getchar()) sum=sum*10+c-48;

	return sum*k;

}

int h,w,a,b;

const int p=1e9+7;

ll fac[300000],inv[300000];

ll ans;

inline ll qsm(ll x,ll k)

{

	ll anss=1,base=x;

	while(k)

	{

		if(k&1) anss=(anss*base)%p;

		base=(base*base)%p;

		k>>=1;

	}

	return anss;

}		

inline ll C(int m,int n){

	if(m==n || m==0) return 1;

	return ((fac[n]*inv[m])%p*inv[n-m])%p;

}

int main(){

	fac[0]=1;

	for(int i=1;i<=200001;++i) fac[i]=(fac[i-1]*i)%p;

	h=read(),w=read(),a=read(),b=read();

	inv[200001]=qsm(fac[200001],p-2);

	for(re int i=200000;i>=1;--i) inv[i]=(inv[i+1]*(i+1))%p;

	for(re int i=1;i<=h-a;++i){

		//cout<<b-1<<" "<<i+b-2<<" "<<w-b-1<<" "<<w+h-b-i-1<<endl;

		//cout<<C(1,2)<<endl;

		ans=(ans+(C(b-1,i+b-2)*C(w-b-1,w+h-b-i-1))%p)%p;

	}

	cout<<ans;

	return 0;

}

/*

6 3

2 3

1 2 

1 4 

4 5 

4 6 

0 2 5 1 2 3 

1 5 

1 3 

2 6 

*/

// Faster C++ solution for the same problem (measured speedup: 1.2379630915778441x):
#include <cstdio>

#define ll long long

using namespace std;

inline int read(){

	int x=0,f=1;char c=getchar();

	while (c>'9'||c<'0') {if (c=='-') f=-1;c=getchar();}

	while ('0'<=c&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();

	return x*f;

}

const int mod(1e9+7),maxn(2e5+5);

int h,w,a,b;

ll fac[maxn],inv[maxn];

ll ans;

ll qpow(ll a,ll b){

	ll sum=1;

	while (b){

		if (b&1) sum=sum*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return sum;

}

void pre(){

	fac[0]=inv[0]=1;

	for (int i(1);i<=maxn;++i) fac[i]=1ll*fac[i-1]*i%mod;

	inv[200000]=qpow(fac[200000],mod-2);

	for (int i(199999);i;--i) inv[i]=1ll*inv[i+1]*(i+1)%mod;

}

void init(){

	h=read(),w=read(),a=read(),b=read();

}

inline ll cal(int x1,int y1,int x2,int y2){

	int n=x2-x1+y2-y1,m=x2-x1;

	if (n==m||m==0) return 1;

	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;

}

int main(){

	pre();

	init();

	for (int i(1);i<=h-a;++i)

		ans=(ans+cal(1,1,i,b)*cal(i,b+1,h,w)%mod)%mod;

	printf("%lld",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long mod=1000000000+7,n,m,h,w,jie[200003],ans;

long long mi(long long x,long long t)

{

	if(t==1)

		return x;

	long long sum=mi(x,t/2);

	sum=(sum*sum)%mod;

	if(t%2==1)

		sum=(sum*x)%mod;

	return sum;

}

long long c(long long n,long long m)

{

	return (mi((jie[n-m]*jie[m])%mod,mod-2)*jie[n])%mod;

}

int main()

{

	cin>>n>>m>>h>>w;

	jie[0]=1,jie[1]=1;

	for(long long i=2; i<=200000; i++)

		jie[i]=(jie[i-1]*i)%mod;

	for(long long i=1; h+i<=n&&w+i<=m; i++)

		ans=(ans+(c(n+w-h-1,w+i-1)*c(h+m-w-1,m-w-i)%mod))%mod;

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.7582857956322397x):
#include <cstdio>

#include <cstring>

using namespace std;

typedef long long ll;

ll n,m,a,b;

ll fpow(ll b,ll p,ll mod)

{

	ll ans=1,tmp=b;

	while(p)

	{

		if(p&1)ans=ans*tmp%mod;

		tmp=tmp*tmp%mod;

		p>>=1;

	}

	return ans%mod;

}

ll inv(ll b,ll mod)

{

	return fpow(b,mod-2,mod)%mod;

}

const int N=200002;

const ll mod=1e9+7;

ll fac[N],ans=0;

ll C(ll n,ll m)

{

	if(n<m)return 0;

	return fac[n]%mod*inv(fac[m],mod)%mod*inv(fac[n-m],mod)%mod;

}

ll Lucas(ll n,ll m)

{

	if(!m)return 1;

	return C(n%mod,m%mod)*Lucas(n/mod,m/mod);

}

int main()

{

	fac[0]=1;

	for(int i=1;i<=200000;i++)fac[i]=fac[i-1]*i%mod;

	scanf("%lld%lld%lld%lld",&n,&m,&a,&b);

	for(ll i=1;i<=n-a&&i<=m-b;i++)

	{

		ll X=n-a-i,Y=b+i-1;

		ans=(ans+Lucas(X+Y,X)%mod*Lucas(m-Y+n-X-2,m-Y-1)%mod)%mod;

	}

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define int long long

#define rg register

#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

using namespace std;

const int N=200000+10;

const int mod=1e9+7;

int read(){

    int x=0,f=1;char c=getchar();

    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();

    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();

    return f*x;

}

int inv[N],jc[N];

int ksm(int a,int b){

	int ans=1;

	while(b){

		if(b&1) ans=ans*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return ans;

}

int C(int n,int m){

	return jc[n]*inv[m]%mod*inv[n-m]%mod;

}

int calc(int x,int y,int X,int Y){

	int n=abs(X-x),m=abs(Y-y);

	return C(n+m,n);

}

main(){

    //file("");

	jc[0]=1;

	for(int i=1;i<=N-10;i++)

		jc[i]=jc[i-1]*i%mod;

	inv[N-10]=ksm(jc[N-10],mod-2);

	for(int i=N-11;i>=0;i--)

		inv[i]=inv[i+1]*(i+1)%mod;

	int H=read(),W=read(),A=read(),B=read(),ans=calc(1,1,H,W);

	for(int i=H-A+1;i<=H;i++)

		ans=(ans-calc(1,1,i,B)*calc(i,B+1,H,W)%mod+mod)%mod;

	cout<<ans;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.4783035822395005x):
#include <cstdio>

#include <cstring>

using namespace std;

typedef long long ll;

ll n,m,a,b;

ll fpow(ll b,ll p,ll mod)

{

	ll ans=1,tmp=b;

	while(p)

	{

		if(p&1)ans=ans*tmp%mod;

		tmp=tmp*tmp%mod;

		p>>=1;

	}

	return ans%mod;

}

ll inv(ll b,ll mod)

{

	return fpow(b,mod-2,mod)%mod;

}

const int N=200002;

const ll mod=1e9+7;

ll fac[N],ans=0;

ll C(ll n,ll m)

{

	if(n<m)return 0;

	return fac[n]%mod*inv(fac[m],mod)%mod*inv(fac[n-m],mod)%mod;

}

ll Lucas(ll n,ll m)

{

	if(!m)return 1;

	return C(n%mod,m%mod)*Lucas(n/mod,m/mod);

}

int main()

{

	fac[0]=1;

	for(int i=1;i<=200000;i++)fac[i]=fac[i-1]*i%mod;

	scanf("%lld%lld%lld%lld",&n,&m,&a,&b);

	for(ll i=1;i<=n-a&&i<=m-b;i++)

	{

		ll X=n-a-i,Y=b+i-1;

		ans=(ans+Lucas(X+Y,X)%mod*Lucas(m-Y+n-X-2,m-Y-1)%mod)%mod;

	}

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long mod=1000000000+7,n,m,h,w,jie[200003],ans;

long long mi(long long x,long long t)

{

	if(t==1)

		return x;

	long long sum=mi(x,t/2);

	sum=(sum*sum)%mod;

	if(t%2==1)

		sum=(sum*x)%mod;

	return sum;

}

long long c(long long n,long long m)

{

	return (mi((jie[n-m]*jie[m])%mod,mod-2)*jie[n])%mod;

}

int main()

{

	cin>>n>>m>>h>>w;

	jie[0]=1,jie[1]=1;

	for(long long i=2; i<=200000; i++)

		jie[i]=(jie[i-1]*i)%mod;

	for(long long i=1; h+i<=n&&w+i<=m; i++)

		ans=(ans+(c(n+w-h-1,w+i-1)*c(h+m-w-1,m-w-i)%mod))%mod;

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3588606500430105x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MOD 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int N;

int n,m,x,y;

LL Pow(LL a,int b)

{

    LL ans=1;

    while(b)

    {

        if(b&1) ans=ans*a%MOD;

        a=a*a%MOD;

        b>>=1;

    }

    return ans;

}

void Pre()

{

    s[0]=1;

    for(int i=1; i<=N; i++)

        s[i]=s[i-1]*i%MOD;

    inv[0]=1;

    inv[N]=Pow(s[N],MOD-2);

    for(int i=N-1; i>0; i--)

        inv[i]=inv[i+1]*(i+1)%MOD;

}

LL C(int a,int b)

{

    if(a<0||b<0) return 1;

    return s[a]*inv[b]%MOD*inv[a-b]%MOD;

}

int main()

{



    scanf("%d%d",&n,&m);

    scanf("%d%d",&x,&y);

    N=n+m-2;

    Pre();

    LL ans=0;

    for(int i=y+1;i<=m;i++)

    {

        ans+=C(n-x+i-2,i-1)*C(x+m-i-1,x-1)%MOD;

        ans%=MOD;

    }

    printf("%lld\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define int long long

#define rg register

#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

using namespace std;

const int N=200000+10;

const int mod=1e9+7;

int read(){

    int x=0,f=1;char c=getchar();

    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();

    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();

    return f*x;

}

int inv[N],jc[N];

int ksm(int a,int b){

	int ans=1;

	while(b){

		if(b&1) ans=ans*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return ans;

}

int C(int n,int m){

	return jc[n]*inv[m]%mod*inv[n-m]%mod;

}

int calc(int x,int y,int X,int Y){

	int n=abs(X-x),m=abs(Y-y);

	return C(n+m,n);

}

main(){

    //file("");

	jc[0]=1;

	for(int i=1;i<=N-10;i++)

		jc[i]=jc[i-1]*i%mod;

	inv[N-10]=ksm(jc[N-10],mod-2);

	for(int i=N-11;i>=0;i--)

		inv[i]=inv[i+1]*(i+1)%mod;

	int H=read(),W=read(),A=read(),B=read(),ans=calc(1,1,H,W);

	for(int i=H-A+1;i<=H;i++)

		ans=(ans-calc(1,1,i,B)*calc(i,B+1,H,W)%mod+mod)%mod;

	cout<<ans;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.051434407901796x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MOD 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int N;

int n,m,x,y;

LL Pow(LL a,int b)

{

    LL ans=1;

    while(b)

    {

        if(b&1) ans=ans*a%MOD;

        a=a*a%MOD;

        b>>=1;

    }

    return ans;

}

void Pre()

{

    s[0]=1;

    for(int i=1; i<=N; i++)

        s[i]=s[i-1]*i%MOD;

    inv[0]=1;

    inv[N]=Pow(s[N],MOD-2);

    for(int i=N-1; i>0; i--)

        inv[i]=inv[i+1]*(i+1)%MOD;

}

LL C(int a,int b)

{

    if(a<0||b<0) return 1;

    return s[a]*inv[b]%MOD*inv[a-b]%MOD;

}

int main()

{



    scanf("%d%d",&n,&m);

    scanf("%d%d",&x,&y);

    N=n+m-2;

    Pre();

    LL ans=0;

    for(int i=y+1;i<=m;i++)

    {

        ans+=C(n-x+i-2,i-1)*C(x+m-i-1,x-1)%MOD;

        ans%=MOD;

    }

    printf("%lld\n",ans);

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

using namespace std;

typedef long long ll;

ll n,m,a,b;

ll fpow(ll b,ll p,ll mod)

{

	ll ans=1,tmp=b;

	while(p)

	{

		if(p&1)ans=ans*tmp%mod;

		tmp=tmp*tmp%mod;

		p>>=1;

	}

	return ans%mod;

}

ll inv(ll b,ll mod)

{

	return fpow(b,mod-2,mod)%mod;

}

const int N=200002;

const ll mod=1e9+7;

ll fac[N],ans=0;

ll C(ll n,ll m)

{

	if(n<m)return 0;

	return fac[n]%mod*inv(fac[m],mod)%mod*inv(fac[n-m],mod)%mod;

}

ll Lucas(ll n,ll m)

{

	if(!m)return 1;

	return C(n%mod,m%mod)*Lucas(n/mod,m/mod);

}

int main()

{

	fac[0]=1;

	for(int i=1;i<=200000;i++)fac[i]=fac[i-1]*i%mod;

	scanf("%lld%lld%lld%lld",&n,&m,&a,&b);

	for(ll i=1;i<=n-a&&i<=m-b;i++)

	{

		ll X=n-a-i,Y=b+i-1;

		ans=(ans+Lucas(X+Y,X)%mod*Lucas(m-Y+n-X-2,m-Y-1)%mod)%mod;

	}

	printf("%lld\n",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.0477756593125895x):
#include<cstdio>

#include<algorithm>

using namespace std;

#define MOD 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int N;

int n,m,x,y;

LL Pow(LL a,int b)

{

    LL ans=1;

    while(b)

    {

        if(b&1) ans=ans*a%MOD;

        a=a*a%MOD;

        b>>=1;

    }

    return ans;

}

void Pre()

{

    s[0]=1;

    for(int i=1; i<=N; i++)

        s[i]=s[i-1]*i%MOD;

    inv[0]=1;

    inv[N]=Pow(s[N],MOD-2);

    for(int i=N-1; i>0; i--)

        inv[i]=inv[i+1]*(i+1)%MOD;

}

LL C(int a,int b)

{

    if(a<0||b<0) return 1;

    return s[a]*inv[b]%MOD*inv[a-b]%MOD;

}

int main()

{



    scanf("%d%d",&n,&m);

    scanf("%d%d",&x,&y);

    N=n+m-2;

    Pre();

    LL ans=0;

    for(int i=y+1;i<=m;i++)

    {

        ans+=C(n-x+i-2,i-1)*C(x+m-i-1,x-1)%MOD;

        ans%=MOD;

    }

    printf("%lld\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long LL;



const int maxn=100000;

const int INF=0x3f3f3f3f;

const int MOD=1e9+7;



struct Point{

	int x,y;

};



int fac[maxn*2+5];



void pre(){

	fac[0]=1;

	for(int i=1;i<=maxn*2;i++){

		fac[i]=1ll*fac[i-1]*i%MOD;

	}

}



LL q_pow(LL x,LL k){

	LL r=1,base=x%MOD;

	while(k){

		if(k&1)r*=base,r%=MOD;

		base*=base,base%=MOD;

		k>>=1;

	}

	return r;

}



LL Cal(Point a,Point b){

	int disx=abs(a.x-b.x),disy=abs(a.y-b.y);

	int dis=disx+disy;

	return 1ll*fac[dis]*q_pow(1ll*fac[disx]*fac[disy],MOD-2)%MOD;

}



int main()

{

	int H,W,A,B;

	scanf("%d%d%d%d",&H,&W,&A,&B);

	pre();

	LL ans=0;

	for(int i=1;i<=H-A;i++){

		ans+=Cal((Point){1,1},(Point){i,B})*Cal((Point){i,B+1},(Point){H,W})%MOD,ans%=MOD;

	}

	printf("%lld\n",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.0810685634171153x):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define R register

const ll mod = 1e9+7;



inline void read(int &x){

	static int ch; static bool flag;

	for(flag=0,ch=getchar(); ch>'9'||ch<'0'; ch=getchar()) flag |= ch=='-';

	for(x=0; ch>='0'&&ch<='9'; ch=getchar()) x = (x<<1) + (x<<3) + ch-48;

	x = flag ? -x : x;

}



int H,W,A,B;

ll Ans,jc[200002],inv[200002];



inline ll ksm(ll a,int b){

	R ll ret=1;

	while(b){

		if(b&1) ret=ret*a%mod;

		a=a*a%mod; b>>=1;

	}

	return ret;

}



inline ll C(int n,int m){

	return jc[n]*inv[m]%mod*inv[n-m]%mod;

}



inline ll calc(int n,int m){

	return C(n+m,m);

}



int main()

{

	read(H),read(W),read(A),read(B);

	jc[0]=inv[0]=1;

	for(R int i=1;i<H+W-1;++i) jc[i]=jc[i-1]*i%mod,inv[i]=ksm(jc[i],mod-2);

	for(R int i=B+1;i<=W;++i)

		Ans=(Ans+calc(H-A-1,i-1)*calc(A-1,W-i)%mod)%mod;

	printf("%lld\n",Ans);

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<algorithm>

#include<cmath>

#define SF scanf

#define PF printf

#define MAXN 200010

#define MOD 1000000007

using namespace std;

int h,w,a,b;

long long d[MAXN],q[MAXN];

long long fsp(long long x,int y){

    long long res=1;

    while(y){

        if(y&1) res=(res*x)%MOD;

        x=(x*x)%MOD;

        y>>=1;

    }

    return res;

}

void prepare(){

    d[0]=1;

    for(int i=1;i<=200000;i++)

        d[i]=(1ll*d[i-1]*i)%MOD;

    q[200000]=fsp(d[200000],MOD-2);

    for(int i=199999;i>=0;i--)

        q[i]=(1ll*q[i+1]*(i+1))%MOD;

}

long long C(int x,int y){

    return ((d[x]*q[y]%MOD)*q[x-y])%MOD;

}

int main(){

    long long del=0;

    prepare();

    SF("%d%d%d%d",&h,&w,&a,&b);

    for(int i=1;i<=b;i++){

        del+=(C(h-a+i-2,i-1)*C(w-i+a-1,a-1))%MOD;

        del%=MOD;

    }

    PF("%lld",(C(w+h-2,h-1)-del+MOD)%MOD);

}


// Faster C++ solution for the same problem (measured speedup: 3.4241754510737787x):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define R register

const ll mod = 1e9+7;



inline void read(int &x){

	static int ch; static bool flag;

	for(flag=0,ch=getchar(); ch>'9'||ch<'0'; ch=getchar()) flag |= ch=='-';

	for(x=0; ch>='0'&&ch<='9'; ch=getchar()) x = (x<<1) + (x<<3) + ch-48;

	x = flag ? -x : x;

}



int H,W,A,B;

ll Ans,jc[200002],inv[200002];



inline ll ksm(ll a,int b){

	R ll ret=1;

	while(b){

		if(b&1) ret=ret*a%mod;

		a=a*a%mod; b>>=1;

	}

	return ret;

}



inline ll C(int n,int m){

	return jc[n]*inv[m]%mod*inv[n-m]%mod;

}



inline ll calc(int n,int m){

	return C(n+m,m);

}



int main()

{

	read(H),read(W),read(A),read(B);

	jc[0]=inv[0]=1;

	for(R int i=1;i<H+W-1;++i) jc[i]=jc[i-1]*i%mod,inv[i]=ksm(jc[i],mod-2);

	for(R int i=B+1;i<=W;++i)

		Ans=(Ans+calc(H-A-1,i-1)*calc(A-1,W-i)%mod)%mod;

	printf("%lld\n",Ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//#define local

//if you find any bug in my code, please tell me.

const int mod=1e9+7;

const int N=2e5+10;

ll fac[N],inv[N];

ll qpow(ll x, int k)

{

    x=x%mod;

    ll ans=1;

    while(k)

    {

        if(k&1) ans=ans*x%mod;

        x=x*x%mod;

        k>>=1;

    }

    return ans;

}

void init()

{

    fac[0]=1;

    for(int i=1; i<N; i++)

        fac[i]=fac[i-1]*i%mod;

    inv[N-1]=qpow(fac[N-1],mod-2);

    for(int i=N-1; i>0; i--)

        inv[i-1]=inv[i]*i%mod;

}

ll comb(int n, int m)

{

    return fac[n]*inv[m]%mod*inv[n-m]%mod;

}

int main()

{

#ifdef local

    freopen("input.txt","r",stdin);

    //freopen("output.txt","w",stdout);

#endif

    init();

    int h,w,a,b;

    ll ans=0,t;

    cin>>h>>w>>a>>b;

    for(int i=b+1; i<=w; i++)

    {

        t=comb(i-1+h-a-1,i-1)*comb(a-1+w-i,a-1)%mod;

        ans=(ans+t)%mod;

    }

    cout<<ans<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.3815514946093455x):
// ===================================

//   author: M_sea

//   website: http://m-sea-blog.com/

// ===================================

#include <algorithm>

#include <iostream>

#include <cstdlib>

#include <cstring>

#include <cstdio>

#include <cmath>

#define re register

using namespace std;



inline int read() {

    int X=0,w=1; char c=getchar();

    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }

    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();

    return X*w;

}



const int N=200000+10;

const int mod=1e9+7;



inline int qpow(int a,int b) { int c=1;

    for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) c=1ll*c*a%mod;

    return c;

}



int fac[N],ifac[N];

inline void init(int n) {

    fac[0]=1;

    for (re int i=1;i<=n;++i) fac[i]=1ll*fac[i-1]*i%mod;

    ifac[n]=qpow(fac[n],mod-2);

    for (re int i=n;i;--i) ifac[i-1]=1ll*ifac[i]*i%mod;

}

inline int calc(int n,int m) {

    return 1ll*fac[n+m]*ifac[n]%mod*ifac[m]%mod;

}



int H,W,A,B;

int main() {

    init(200000);

    H=read(),W=read(),A=read(),B=read();

    int ans=0;

    for (re int x=H-A,y=B+1;x>=1&&y<=W;--x,++y)

        ans=(ans+1ll*calc(x-1,y-1)*calc(H-x,W-y))%mod;

    printf("%d\n",ans);

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<cstring>

using namespace std;



#define REP(i,e,s) for(register int i=e; i<=s; i++)

#define DREP(i,e,s) for(register int i=e; i>=s; i--)

#define ll long long

#define DE(...) fprintf(stderr,__VA_ARGS__)

#define DEBUG(a) DE("DEBUG: %d\n",a)



#define int long long



int read() {

	int x=0,f=1,ch=getchar();

	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}

	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}

	return x*f;

}

const int MOD=1e9+7,MAXN=200000+10;



int fac[MAXN],inv[MAXN];



int qpow(int a,int b) {

	int ans=1;

	while(b) {

		if(b&1) ans=(ans*a)%MOD;

		a=(a*a)%MOD;

		b>>=1;

	}

	return ans;

}



int c(int m,int n) {

	if(n==m||!m||!n) return 1;

	return ((fac[m]*inv[n]%MOD)*inv[m-n])%MOD;

}



int calc(int x_1,int y_1,int x_2,int y_2) {

	return c(abs(x_2-x_1)+abs(y_2-y_1),abs(x_2-x_1));

}



signed main() {

	int h=read(),w=read(),a=read(),b=read();

	fac[0]=1;

	REP(i,1,h+w) fac[i]=(fac[i-1]*i)%MOD;

	

	REP(i,1,h+w) inv[i]=qpow(fac[i],MOD-2);

	int ans=0;	

	REP(i,1,h-a) {

		ans=(ans+calc(1,1,b,i)*(calc(b+1,i,w,h)))%MOD;

	}

	

	printf("%lld\n",ans%MOD);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.159741215242009x):
#include <stdio.h>

#define N 200002

#define M 1000000007

typedef long long LL;





LL f[N], ans, invf[N], sum, t1, t2;



LL qpow(LL x, int y)

{

	if(!y) return 1;

	LL t = qpow(x, y >> 1);

	t = t * t % M;

	if(y & 1) t = t * x % M;

	return t;

}



int main()

{		

	int T, i, j, x, a, b, c, d, y, m, t;

	

	scanf("%d%d%d%d", &a, &b, &c, &d);

	x = a - c - 1, y = c - 1;

	m = b - d - 1 + y;

	t = b - 1 + x;

	if(t > m) m = t;

	f[0] = f[1] = 1;

	for(i = 2, j = 1; i <= m; j = i++){

		f[i] = f[j] * (LL)i % M;

	} 

	invf[m] = qpow(f[m], M - 2);

	for(i = m, j = m - 1; j >= 0; i = j--){

		invf[j] = invf[i] * (LL)i % M;

	}

	

	ans = invf[x] * invf[y] % M;

	for(i = d, sum = 0, j = b - 1 - d; i < b; i++, j--){

		t1 = f[i + x] * invf[i] % M;

		t2 = f[j + y] * invf[j] % M;

		sum += t1 * t2 % M;

	}

	ans = sum % M * ans % M;

	printf("%lld\n", ans);

			

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

const int p=1e9+7;

using namespace std;

#define ll long long

const int N=2e5+20;

const ll mod=1e9+7;

ll f[N],n,m,a,b;

ll powmod(ll x,ll n)

{

    ll s=1;

    while(n)

    {

        if(n&1)

            s=(s*x)%mod;

        x=(x*x)%mod;

        n>>=1;

    }

    return s;

}

ll C(ll n,ll m)

{

    ll aa=f[n];

    ll bb=(f[m]*f[n-m])%mod;

    return (aa*powmod(bb,mod-2))%mod;

}

int main()

{

    ll i,j;

    f[0]=1;

    for(i=1; i<N; i++)

        f[i]=(f[i-1]*i)%mod;

    ll ans=0,cnt=0;

    while(cin>>n>>m>>a>>b)

    {

        ans=0;

        for(i=1; i<=n-a; i++)

        {

            ans+=(C(b+i-2,i-1)*C(m+n-b-i-1,n-i))%mod;

            ans%=mod;

        }

        cout<<ans<<endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.5227884053282392x):
#include<cstdio>

#include<iostream>

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll pow(ll a, ll b, ll m) {

    ll res = 1;

    for (a %= m; b; b >>= 1, (a *= a) %= m)

        if (b & 1) (res *= a) %= m;

    return res;

}

ll n, m, a, b, ans, f[200005];

ll inv(ll x) {

    return pow(x, mod - 2, mod);

}

ll C(ll n, ll k) {

    return f[n] * inv(f[n-k]) % mod * inv(f[k]) % mod;

}

ll calc(ll n, ll m) {

    return C(n + m, m);

}

int main() {

    cin >> n >> m >> a >> b; f[0] = 1;

    for (ll i = 1; i <= n + m - 2; ++i)

        f[i] = f[i-1] * i % mod;

    for (ll i = b + 1; i <= m; ++i) {

        (ans += calc(n - a - 1, i - 1) % mod * calc(a - 1, m - i)) %= mod;

    }

    ans = (ans % mod + mod) % mod;

    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



#define LL long long

#define RG register



using namespace std;

template<class T> inline void read(T &x) {

	x = 0; RG char c = getchar(); bool f = 0;

	while (c != '-' && (c < '0' || c > '9')) c = getchar(); if (c == '-') c = getchar(), f = 1;

	while (c >= '0' && c <= '9') x = x*10+c-48, c = getchar();

	x = f ? -x : x;

	return ;

}

template<class T> inline void write(T x) {

	if (!x) {putchar(48);return ;}

	if (x < 0) x = -x, putchar('-');

	int len = -1, z[20]; while (x > 0) z[++len] = x%10, x /= 10;

	for (RG int i = len; i >= 0; i--) putchar(z[i]+48);return ;

}

const int N = 200010, Mod = 1e9 + 7;

int fac[N], ifac[N], H, W, A, B;

int fpow(int a, int b) {

	int res = 1;

	for (; b; b >>= 1, a = 1ll * a * a % Mod)

		if (b & 1) res = 1ll * res * a % Mod;

	return res;

}

int C(int n, int m) {

	if (n < m) return 0;

	return 1ll * fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;

}

int calc(int n, int m) {

	return C(n + m - 2, n - 1);

}

int main() {

	//freopen(".in", "r", stdin);

	//freopen(".out", "w", stdout);

	read(H), read(W), read(A), read(B);

	fac[0] = 1;

	for (int i = 1; i <= 200000; i++)

		fac[i] = 1ll * fac[i - 1] * i % Mod;

	ifac[200000] = fpow(fac[200000], Mod - 2);

	for (int i = 200000; i >= 1; i--)

		ifac[i - 1] = 1ll * ifac[i] * i % Mod;

	int ans = 0;

	for (int i = B + 1; i <= W; i++)

		(ans += 1ll * calc(H - A, i) * calc(A, W - i + 1) % Mod) %= Mod;

	printf("%d\n", ans);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.2649629864325846x):
#include <iostream>

#include <cstdio>

#include <cstring>

#define int long long

#define fre(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)

using namespace std;



inline int read(){

	int sum=0,f=1;char ch=getchar();

	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}

	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}

	return f*sum;

}



const int N=200055;

const int Mod=1000000007;

int n,m,A,B,ans,jc[N]={1};



inline int fpow(int a,int b){

	int ret=1;

	for(;b;b>>=1,a=a*a%Mod) if(b&1) ret=ret*a%Mod;

	return ret;

}



inline int inv(int x){

	return fpow(x,Mod-2);

}



inline int C(int n,int m){

	return jc[n]*inv(jc[m])%Mod*inv(jc[n-m])%Mod;

}



inline int get(int x1,int y1,int x2,int y2){

	int x=x2-x1+1,y=y2-y1+1;

	return C(x+y-2,y-1);

}



signed main(){

	n=read();m=read();A=read();B=read();

	for(int i=1;i<N;i++) jc[i]=jc[i-1]*i%Mod;

	int x=n-A,y=B+1;

	while(x&&y<=m){

		ans=(ans+get(1,1,x,y)*get(x,y,n,m)%Mod)%Mod;

		x--;y++;

	}

	printf("%lld\n",ans);

	return 0;

}