stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<climits>

#include<algorithm>

#include<cmath>

#include<queue>

using namespace std;

#define MAXN 100000

#define M 1000000007

#define LL long long

LL n,m,p,q,ans,S;

LL fac[MAXN*2+5],inv[MAXN*2+5];

LL fst_pow(LL A,int B)

{

	LL ret=1;

	while(B)

	{

		if(B&1)ret=ret*A%M;

		A=A*A%M;

		B>>=1;

	}

	return  ret;

}

void init()

{

	fac[0]=1;

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

	{

		fac[i]=(fac[i-1]*(i%M))%M;

	}

	inv[S]=fst_pow(fac[S],M-2);

	inv[0]=1;

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

	{

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

	}

}

LL Comb(int N,int R)

{

	if(N<0||R<0)return 1;

	return fac[N]*inv[R]%M*inv[N-R]%M;

}

int main()

{

	scanf("%lld%lld%lld%lld",&n,&m,&p,&q);

	S=n+m-2;

	init();

	ans=Comb(n+m-2,n-1);

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

	{

		ans-=Comb(n-p+i-2,n-p-1)*Comb(p-1+m-i,p-1)%M;

		//printf("%lld %lld\n",Comb(n-p+i-2,n-p-1),Comb(p-1+m-i,p-1));

		ans=(ans%M+M)%M;

	}

	printf("%lld",ans);

}

//2 3 1 1

//10 7 3 4


// Optimized solution to the same problem (faster):
#include<cstdio>



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

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

    //inv[fac[i]]=Pow(fac[i],MOD-2)=Pow(1,MOD-2)...Pow(i,MOD-2)

    //inv[fac[i-1]]=Pow(fac[i-1],MOD-2)=Pow(1,MOD-2)...Pow(i-1,MOD-2)=Pow(fac[i],MOD-2)/Pow(i,MOD-2)=inv[i]*i

    inv[0]=1;

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

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

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

}



LL C(int m,int n){

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

}



int main(){

    int H,W,A,B;

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

    Prep(H+W);

    LL Ans=0;

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

        LL tmp1=C(H-A+i-2,i-1);

        //C(m+n-x-y-2,m-x-1)

        //(H-A,i) -> (H,W)

        LL tmp2=C(A+W-i-1,A-1);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

typedef long long LL;

const int maxn=1e5+10;

const int mod=1e9+7;

LL H,W,a,b;

LL s[2*maxn+10],inv[2*maxn+10];



inline LL qpow(LL a,LL b) {

    LL res=1;

    while (b) {

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

        a=a*a%mod;

        b>>=1;

    }

    return res%mod;

}



void _init() {

    s[0]=s[1]=1;

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

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



    inv[0]=1; inv[2*maxn]=qpow(s[2*maxn],mod-2);

    for (int i=2*maxn-1;i>=1;i--) inv[i]=inv[i+1]*(i+1)%mod;

}



LL C(LL m,LL n) {

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

}



int main() {

    _init();

    scanf("%lld%lld%lld%lld",&H,&W,&a,&b);

    LL ans=0;

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

        ans=(ans+C(H-a+i-2,H-a-1)*C(W+a-i-1,a-1)%mod)%mod;

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

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll mod=1000000007;

ll fac[200005];

void init()

{

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

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

    {

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

    }

    return ;

}

ll pow(ll a,ll n)

{

    ll ans=1;

    while(n)

    {

        if(n&1)

        {

            ans=ans*a%mod;

        }

        a=a*a%mod;

        n=n>>1;

    }

    return ans;

}

ll work(ll m,ll n)

{

    ll ans=fac[m+n-2];

    ans=ans*pow(fac[n-1],mod-2)%mod;

    ans=ans*pow(fac[m-1],mod-2)%mod;

    return ans;

}

int main()

{

    ll h,w,a,b;

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

    init();

    ll pre=0,ans=0,k=w-b;

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

    {

        ll cnt=work(h-a,i);

        ll tmp=cnt*work(a,w-i+1)%mod;

        ans=(ans+tmp)%mod;

    }

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <climits>

#include <cstring>

#include <string>

#include <set>

#include <bitset>

#include <map>

#include <queue>

#include <stack>

#include <vector>

#define rep(i,m,n) for(i=m;i<=n;i++)

#define mod 1000000007

#define inf 0x3f3f3f3f

#define vi vector<int>

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define ll long long

#define pi acos(-1.0)

#define pii pair<int,int>

#define sys system("pause")

const int maxn=2e5+10;

const int N=1e3+10;

using namespace std;

ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}

ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}

int n,m,k,t,h,w,a,b;

ll fac[maxn],inv[maxn];

void init()

{

    fac[0]=1;

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

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

    for(int i=maxn-11;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;

}

ll C(int x,int y)

{

    return fac[x]*inv[y]%mod*inv[x-y]%mod;

}

int main()

{

    int i,j;

    init();

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

    ll ret=C(h+w-2,h-1);

    for(i=0;i<=b-1;i++)ret=(ret-C(i+h-a-1,h-a-1)*C(w-i+a-2,a-1)%mod+mod)%mod;

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

    return 0;

}


// Optimized solution to the same problem (faster):
#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 H,W,A,B;

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 %d %d",&H,&W,&A,&B);

	N=H+W-2;

	Pre();

	LL ans=C(H+W-2,H-1);

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

	{

		ans-=C(H-A+i-2,H-A-1)*C(A-1+W-i,A-1)%MOD;

		ans=(ans%MOD+MOD)%MOD;

	}

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cmath>

#include <algorithm>

#include <cstdio>

#include <cstring>

typedef long long ll;

#define rep(i,s,t) for (ll i = s ; i < t ; ++ i)

#define mod 1000000007

#define maxn 200005



using namespace std;



ll fac[maxn],inv[maxn];



int f(ll a,ll b)

{

    ll ans = 1;

    while (b)

    {

        if (b%2)

           ans = ans * a % mod;

        a = a * a % mod;

        b /= 2;

    }

    return ans;

}



void init()

{

    fac[0] = 1;

    rep(i,1,maxn)

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

    inv[maxn-1] = f(fac[maxn-1],mod-2);

    for (ll i = maxn-2 ; i >=0 ; -- i)

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

}

int main()

{

    init();

    int h,w,a,b;

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

    ll ans = 0;

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

    {

        int sum = h - a + i - 2 ;

        ll cmp1 = fac[sum] * inv[i - 1] % mod;

        cmp1 = cmp1 * inv[h-a-1] % mod;



        sum = a + w - i - 1;

        ll cmp2 = fac[sum] * inv[a - 1] % mod;

        cmp2 = cmp2 * inv[w-i] % mod;



        cmp1 = cmp1 * cmp2 % mod;

        ans = (ans + cmp1) % mod;

    }

    cout<< ans <<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#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 H,W,A,B;

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 %d %d",&H,&W,&A,&B);

	N=H+W-2;

	Pre();

	LL ans=C(H+W-2,H-1);

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

	{

		ans-=C(H-A+i-2,H-A-1)*C(A-1+W-i,A-1)%MOD;

		ans=(ans%MOD+MOD)%MOD;

	}

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstring>

#include <cstdio>

#include <algorithm>

#include <cmath>

using namespace std;

#define ll long long

#define maxn 210000

#define mod 1000000007

const int m=1e9+7;

ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}

ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}

int n,k,t,h,w,a,b;

ll fac[maxn],inv[maxn];

void init()

{

    fac[0]=1;

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

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

    for(int i=maxn-11;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;

}

ll C(int x,int y)

{

    return fac[x]*inv[y]%mod*inv[x-y]%mod;

}

int main()

{

    //freopen("de.txt","r",stdin);

    init();

    while (~scanf("%d%d%d%d",&h,&w,&a,&b)){

        ll ans=C(h+w-2,h-1);

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

            ll temp1=C(i+h-1-a,i);

            ll temp2=C(w-i+a-2,a-1);

            ll temp3=(temp1*temp2)%mod;

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

        }

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

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#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 H,W,A,B;

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 %d %d",&H,&W,&A,&B);

	N=H+W-2;

	Pre();

	LL ans=C(H+W-2,H-1);

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

	{

		ans-=C(H-A+i-2,H-A-1)*C(A-1+W-i,A-1)%MOD;

		ans=(ans%MOD+MOD)%MOD;

	}

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<algorithm>

#define MOD 1000000007

#define MAXN 200006

using namespace std;

long long fac[MAXN],inv[MAXN],ans;

int n,m,a,b;

long long ksm(long long a,long long m)

{

	if(m==0) return 1;

	long long nex=ksm(a,m/2);

	nex=(nex*nex)%MOD;

	if(m%2==0) return nex;

	else return (nex*a)%MOD;

}

void waiting()

{

	fac[0]=1;

	for(long long i=1;i<MAXN;i++)

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

	inv[MAXN-1]=ksm(fac[MAXN-1],MOD-2);

	for(long long i=MAXN-2;i>=0;i--)

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

}

long long C(int n,int m)

{

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

}

int main()

{

	waiting();

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

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

	{

		long long p1=C(b-1,b+i-2);

		long long p2=C(m-b-1,m-b+n-i-1);

		long long p=(p1*p2)%MOD;

		ans=(ans+p)%MOD;

	}

	printf("%lld",ans);

}

// Optimized solution to the same problem (faster):
#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 H,W,A,B;

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 %d %d",&H,&W,&A,&B);

	N=H+W-2;

	Pre();

	LL ans=C(H+W-2,H-1);

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

	{

		ans-=C(H-A+i-2,H-A-1)*C(A-1+W-i,A-1)%MOD;

		ans=(ans%MOD+MOD)%MOD;

	}

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

#define int long long

#define MOD (long long)(1e9+7)

#define MAX_VAL (long long)(1e5*2+100)



long long fac[MAX_VAL], mmi[MAX_VAL], temp[MAX_VAL];



void factorial(){

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

	for(long long i = 2; i < MAX_VAL; fac[i]%=MOD,i++)

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

}





long long power_mod(long long x, long long n){

	long long ans = 1;

	for(;n;n>>=1,x*=x,ans%=MOD,x%=MOD)

		if(n&1)ans*=x;

	return ans%MOD;

}



void modular_multiplicatibe_inverse(){

	mmi[MAX_VAL-1] = power_mod(fac[MAX_VAL-1],MOD-2);

	for(long long i = MAX_VAL-2; i >= 0; mmi[i]%=MOD,i--)

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

}



long long combination(long long n, long long r){

	return fac[n]*(mmi[r]*mmi[n-r]%MOD)%MOD;

}



signed main(){

	int H, W, A, B, ans = 0;

	cin>>H>>W>>A>>B;

	factorial();

	modular_multiplicatibe_inverse();



	for(int i = B+1; i <= W; ans%=MOD,i++)

		ans += combination(i+H-A-2,H-A-1)*combination(A+W-i-1,W-i)%MOD;

	

	cout<<ans<<endl;



}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

#define int long long

#define MOD (long long)(1e9+7)

#define MAX_V (long long)(1e5*2+200)



long long MAX_VAL, MAX_VAL2;

long long fac[MAX_V], mmi[MAX_V], temp[MAX_V];



inline void factorial(){

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

	for(long long i = 2; i < MAX_VAL; fac[i]%=MOD,i++)

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

}



inline long long power_mod(long long x, long long n){

	long long ans = 1;

	for(;n;n>>=1,x*=x,ans%=MOD,x%=MOD)

		if(n&1)ans*=x;

	return ans;

}



inline void modular_multiplicatibe_inverse(){

	mmi[MAX_VAL2-1] = power_mod(fac[MAX_VAL2-1],MOD-2);

	for(long long i = MAX_VAL2-2; i >= 0; mmi[i]%=MOD,i--)

		mmi[i] = mmi[i+1]*(i+1);

}



inline long long combination(long long n, long long r){

	return fac[n]*(mmi[r]*mmi[n-r]%MOD)%MOD;

}



inline long long foo(long long n, long long r){

}

signed main(){

	int H, W, A, B, ans = 0;

	cin>>H>>W>>A>>B;

	MAX_VAL = max(W+H-A-2,A+W-1)+5;

	MAX_VAL2 = max(max(W-B+1,W-1),max(H-A-1, A-1))+3;

	

	factorial();

	modular_multiplicatibe_inverse();



	for(int i = B+1; i <= W; ans%=MOD,i++)

		ans += combination(H-A+i-2,H-A-1)*combination(W+A-i-1,A-1);

	cout<<ans<<endl;



}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



typedef pair<int,int> ii;

#define fi first

#define se second



const int N = 2e5 + 5;

const int MOD = 1e9 + 7;



int h, w, a, b;

int fac[N], ifac[N];



int fpow(int x,int y) {

	int ret = 1;

	while (y) {

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

		x = 1LL * x * x % MOD;

		y >>= 1;

	}

	return ret;

}



int C(int n,int k) {

	if (n < k || k < 0) return 0;

	int ret = 1LL * ifac[k] * ifac[n - k] % MOD;

	ret = 1LL * ret * fac[n] % MOD;

	return ret; 

}



int main() {

	ios_base::sync_with_stdio(false);

	fac[0] = 1; for (int i = 1; i < N; ++i) fac[i] = 1LL * fac[i - 1] * i % MOD;

	ifac[N - 1] = fpow(fac[N - 1], MOD - 2);

	for (int i = N - 2; i >= 0; --i) ifac[i] = 1LL * ifac[i + 1] * (i + 1) % MOD;

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

	int res = 0;

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

		int j = b + 1;

		int add;

		if (i == h - a) add = 1LL * C(i + j - 2, i - 1) * C(h - i + w - j, h - i) % MOD;

		else add = 1LL * C(i + j - 2, i - 1) * C(h - i + w - j - 1, w - j - 1) % MOD; 

		res += add; if (res >= MOD) res -= MOD;

	}

	cout << res;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

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

    inv[0]=1;

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

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

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

}



LL C(int m,int n){

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

}



int main(){

    int H,W,A,B;

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

    Prep(H+W);

    LL Ans=0;

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

        LL tmp1=C(H-A+i-2,i-1);

        LL tmp2=C(A+W-i-1,W-i);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define MOD 1000000007

#define pb push_back

#define int long long

#define bw(i,r,l) for (int i=r-1;i>=l;i--)

#define fw(i,l,r) for (int i=l;i<r;i++)

#define fa(i,x) for (auto i:x)

using namespace std;

const int N=2e5+5;

int h,w,a,b;

int fac[N+1];

struct math {

	int fpow(int a,int p,int mod) {

		if (!p) return 1;

		int ans=fpow(a,p>>1,mod); ans*=ans; ans%=mod;

		if (p&1) {ans*=a; ans%=mod;}

		return ans;

	}

	int inv(int a,int mod) {return fpow(a,mod-2,mod);}

	void preC(int n,int mod) {

		fac[0]=1;

		fw (i,1,n+1) fac[i]=fac[i-1]*i%mod;

	}

	int getC(int k,int n,int mod) {if (k<0) return 0; if (k>n) return 0; if (!k) return 1; return fac[n]*inv(fac[k]*fac[n-k]%mod,mod)%mod;}

} m;

int ans=0;

signed main() {

	//freopen("aome.inp","r",stdin);

	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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

	/*

	Use inclusion - exlusion, we will count number of invalid paths

	Invalid path: A path that will enter the forbidden area at some point

	Check through all first columns of the forbidden area, we can see a valid path always go from

	the spot right above it down to it. So we just count easily.

	*/

	m.preC(N,MOD);

	ans=m.getC(w-1,h+w-2,MOD);

	fw (i,1,b+1) {

		//cout<<"Reach: "<<m.getC(i-1,h-a+i-2,MOD)<<", to end: "<<m.getC(a-1,w-i+a-1,MOD)<<"\n";

		ans-=m.getC(i-1,h-a+i-2,MOD)*m.getC(a-1,w-i+a-1,MOD)%MOD;

		if (ans<0) ans+=MOD;

	}

	cout<<ans;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

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

    inv[0]=1;

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

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

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

}



LL C(int m,int n){

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

}



int main(){

    int H,W,A,B;

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

    Prep(H+W);

    LL Ans=0;

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

        LL tmp1=C(H-A+i-2,i-1);

        LL tmp2=C(A+W-i-1,W-i);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



#define int long long

const int MOD = 1e9 + 7;

int f[200001], c[200001];



int binpw(int ba, int exp){

    int ans = 1;

	while(exp != 0){

	    if(exp % 2 != 0) ans *= ba;

	    ans %= MOD;

	    ba = ba * ba % MOD;

	    exp /= 2;

	}

	return ans;

}



int C(int a, int b){

	int ans = (c[a + b] * f[a]) % MOD;

	return (ans * f[b]) % MOD;

}



signed main()

{

	int h, w, a, b;

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

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

	for(int i = 1; i <= h + w; i++){

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

		f[i] = binpw(c[i], MOD - 2);

	}

	int ans = 0;

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

		ans += C(h - a - 1, i - 1) * C(a - 1, (w - i));

		ans %= MOD;

	}

	cout << ans;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

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

    inv[0]=1;

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

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

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

}



LL C(int m,int n){

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

}



int main(){

    int H,W,A,B;

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

    Prep(H+W);

    LL Ans=0;

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

        LL tmp1=C(H-A+i-2,i-1);

        LL tmp2=C(A+W-i-1,W-i);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



#define int long long



const int   N   = 2e5 + 1;

const int   mod = 1e9 + 7;



int qpow(int a,int exp) {

    int ans = 1;

    while(exp)  {

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

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

    }

    return ans;

}



int F[N], I[N];

int h, w, a, b;



int combi(int n,int k)  {

    if(n < 0 || k < 0 || n < k) return 0;

    int ans = I[k] * I[n - k] % mod;

    return ans * F[n] % mod;

}

signed main()   {

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



    F[0] = I[0] = 1;

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

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

    I[h + w] = qpow(F[h + w],mod - 2);

    for(int i = h + w - 1 ; i ; --i)

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

    int ans = 0;

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

        ans = (ans + combi(i + h - a - 2,i - 1) * combi(w - i + a - 1,a - 1)) % mod;

    cout << ans << endl;

}


// Optimized solution to the same problem (faster):
#include<cstdio>



#define LL long long

#define MAXN 100000

#define MOD 1000000007

LL fac[2*MAXN+5];

LL inv[2*MAXN+5];



LL Pow(LL x,LL p){

    LL ret=1;

    while(p){

        if(p&1)

            ret=ret*x%MOD;

        x=(x*x)%MOD;

        p>>=1;

    }

    return ret;

}



void Prep(int N){

    fac[0]=1;

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

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

    inv[0]=1;

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

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

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

}



LL C(int m,int n){

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

}



int main(){

    int H,W,A,B;

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

    Prep(H+W);

    LL Ans=0;

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

        LL tmp1=C(H-A+i-2,i-1);

        LL tmp2=C(A+W-i-1,W-i);

        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;

    }

    printf("%lld",Ans);

}

// Fastest known solution for this problem: