stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}

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

#include<algorithm>

using namespace std;

typedef long long ll;

const int Mod=1e9+7;

const int Maxn=2*100000;

int H,W,A,B;

ll f[Maxn+10],inv[Maxn+10];

int N;

ll PowMod(ll a,int b) {

	ll ret=1;

	while(b) {

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

		a=a*a%Mod;

		b>>=1;

	}

	return ret;

}

void Init() {

	f[0]=1;

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

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

    inv[0]=1;

    inv[N]=PowMod(f[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 f[a]*inv[b]%Mod*inv[a-b]%Mod;

}

int main() {

	#ifdef LOACL

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

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

	#endif

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

	N=H+W-2;

	Init();

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

	for(ll 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",ans);

	return 0;

}
// Slower C++ solution:
#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;

}


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

#include<algorithm>

using namespace std;

typedef long long ll;

const int Mod=1e9+7;

const int Maxn=2*100000;

int H,W,A,B;

ll f[Maxn+10],inv[Maxn+10];

int N;

ll PowMod(ll a,int b) {

	ll ret=1;

	while(b) {

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

		a=a*a%Mod;

		b>>=1;

	}

	return ret;

}

void Init() {

	f[0]=1;

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

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

    inv[0]=1;

    inv[N]=PowMod(f[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 f[a]*inv[b]%Mod*inv[a-b]%Mod;

}

int main() {

	#ifdef LOACL

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

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

	#endif

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

	N=H+W-2;

	Init();

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

	for(ll 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",ans);

	return 0;

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

using namespace std;

#define fi first

#define se second

#define pb push_back

#define mp make_pair

#define int long long

const int N = 1e5 + 5;

const int M = 1e6 + 5;

const int mod = 1e9 + 7;

typedef vector<int> vi;

typedef pair<int, int> ii;

typedef vector<ii> vii;

typedef set<int> si;

typedef map<string, int> msi;

int po(int x,int y)

{

	if(y == 0) return 1;

	int temp = po(x,y/2);

	if(y % 2 == 0) return temp * temp % mod;

	else return temp * temp % mod * x % mod;

}

int mul[2 * M], dv[2 * M];

int ckn(int k,int n)

{

	return mul[n] * dv[k] % mod * dv[n - k] % mod;

}

signed main(){

	int h, w , a , b;

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

	mul[0] = dv[0] = 1;

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

	{

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

		dv[i] = dv[i - 1] * po(i,mod -2) % mod;

	}

	int ans = 0;

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

	{

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

	}

	cout << ans;

}

	

	




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

#include<algorithm>

using namespace std;

typedef long long ll;

const int Mod=1e9+7;

const int Maxn=2*100000;

int H,W,A,B;

ll f[Maxn+10],inv[Maxn+10];

int N;

ll PowMod(ll a,int b) {

	ll ret=1;

	while(b) {

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

		a=a*a%Mod;

		b>>=1;

	}

	return ret;

}

void Init() {

	f[0]=1;

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

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

    inv[0]=1;

    inv[N]=PowMod(f[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 f[a]*inv[b]%Mod*inv[a-b]%Mod;

}

int main() {

	#ifdef LOACL

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

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

	#endif

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

	N=H+W-2;

	Init();

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

	for(ll 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",ans);

	return 0;

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

using namespace std;



long long mod=1e9+7;

long long fact[200010];

long long poww(long long a, long long b){

  long long res = 1;

  while (b){

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

    a = (a * a) % mod;

    b >>= 1;

  }

  return res;

}

long long C(long long k,long long n)

{

    return fact[n] * poww(fact[k],mod-2) % mod * poww(fact[n-k],mod-2) % mod;

}

int main()

{

    long long h,w,a,b;

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

    fact[0]=1;

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

    {

        fact[i]=fact[i-1]*i;

        fact[i]=fact[i] % mod;

    }

    //cout << C(3,5);

    long long ans=0;

    for(long long i=1;i<=w-b;i++)

    {

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

        ans=ans%mod;

    }

    cout << ans << "\n";

}


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

#include<algorithm>

using namespace std;

typedef long long ll;

const int Mod=1e9+7;

const int Maxn=2*100000;

int H,W,A,B;

ll f[Maxn+10],inv[Maxn+10];

int N;

ll PowMod(ll a,int b) {

	ll ret=1;

	while(b) {

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

		a=a*a%Mod;

		b>>=1;

	}

	return ret;

}

void Init() {

	f[0]=1;

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

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

    inv[0]=1;

    inv[N]=PowMod(f[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 f[a]*inv[b]%Mod*inv[a-b]%Mod;

}

int main() {

	#ifdef LOACL

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

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

	#endif

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

	N=H+W-2;

	Init();

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

	for(ll 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",ans);

	return 0;

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

using namespace std;

vector<long long> res1; 

vector<long long> res2;

long long mod=1e9+7;

long long fact[200010];

long long poww(long long x,long long n)

{

	if(n==0)

	return 1*1LL;

	else if(n%2==0)

	{

		return poww(x,n/2)*poww(x,n/2)%mod;

	}

	else if(n%2!=0)

	{

		return poww(x,n/2)*poww(x,n/2)%mod*x%mod;

	}

}

long long C(long long k,long long n)

{

	if(k==0||n==0) return 1*1LL;

	if(k>n) return 0*1LL;

	return poww(fact[k],mod-2)%mod * poww(fact[n-k],mod-2)%mod * fact[n]%mod;

}

int main()

{

	//ios_base::sync_with_stdio(0);

	//cin.tie(0);

	//cout.tie(0);

	fact[0]=1*1LL;

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

	{

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

	}

	long long h,w,a,b;

	long long ans=0;

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

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

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

		ans=ans%mod;

	}

	cout<<ans%mod;

	//cout  << C(99,1000);

}

//yyyyyyy

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

#include<algorithm>

using namespace std;

typedef long long ll;

const int Mod=1e9+7;

const int Maxn=2*100000;

int H,W,A,B;

ll f[Maxn+10],inv[Maxn+10];

int N;

ll PowMod(ll a,int b) {

	ll ret=1;

	while(b) {

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

		a=a*a%Mod;

		b>>=1;

	}

	return ret;

}

void Init() {

	f[0]=1;

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

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

    inv[0]=1;

    inv[N]=PowMod(f[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 f[a]*inv[b]%Mod*inv[a-b]%Mod;

}

int main() {

	#ifdef LOACL

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

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

	#endif

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

	N=H+W-2;

	Init();

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

	for(ll 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",ans);

	return 0;

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

#include<algorithm>

#define mod 1000000007

using namespace std;

typedef long long ll;

#define LL long long 

ll je[200010];

ll x,y;

LL Gcd(LL a, LL b, LL &x, LL &y)

{

    if(b==0)

	{

        x=1;

        y=0;

        return a;

    }

    LL gcd=Gcd(b,a%b,x,y);

    LL tmp=x;

    x=y;

    y=tmp-(a/b)*y;

    return gcd;

}

LL C(LL m,LL n)

{

    Gcd(je[m]*je[n-m]%mod,mod,x,y);

    return je[n]*(x+mod)%mod;

}

int main()

{

	LL H,W,A,B;

    je[0]=1;

    for(LL i=1;i<200005;i++)

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

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

    LL ans=0;

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

    {

        LL tmp=(C(H-A-1,i-1+H-A-1)*C(W-i,W-i+A-1))%mod;

        ans=(ans+tmp)%mod;

    }

    printf("%lld",ans);

    return 0;

}


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

#include<algorithm>

using namespace std;

typedef long long ll;

const int Mod=1e9+7;

const int Maxn=2*100000;

int H,W,A,B;

ll f[Maxn+10],inv[Maxn+10];

int N;

ll PowMod(ll a,int b) {

	ll ret=1;

	while(b) {

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

		a=a*a%Mod;

		b>>=1;

	}

	return ret;

}

void Init() {

	f[0]=1;

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

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

    inv[0]=1;

    inv[N]=PowMod(f[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 f[a]*inv[b]%Mod*inv[a-b]%Mod;

}

int main() {

	#ifdef LOACL

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

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

	#endif

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

	N=H+W-2;

	Init();

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

	for(ll 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",ans);

	return 0;

}
// Slower C++ solution:
#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;

}

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

#include<algorithm>

using namespace std;

#define MO 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int n;

LL PowMod(LL a,int b)//快速幂

{

	LL ret=1;

	while(b)

	{

		if(b%2==1)

			ret=ret*a%MO;

		a=a*a%MO;

		b/=2;

	}

	return ret;

}

void Pre()//预处理：计算逆元

{

	s[0]=1;

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

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

	inv[0]=1;

	inv[n]=PowMod(s[n],MO-2);

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

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

}

LL C(int a,int b)//组合C

{

	if(a<0||b<0)

		return 1;

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

}

int main()

{

	int h,w,A,B;

	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)%MO;

		ans=(ans%MO+MO)%MO;

	}

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

	return 0;

}
// Slower C++ solution:
#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;

}

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

#include<algorithm>

using namespace std;

#define MO 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int n;

LL PowMod(LL a,int b)//快速幂

{

	LL ret=1;

	while(b)

	{

		if(b%2==1)

			ret=ret*a%MO;

		a=a*a%MO;

		b/=2;

	}

	return ret;

}

void Pre()//预处理：计算逆元

{

	s[0]=1;

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

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

	inv[0]=1;

	inv[n]=PowMod(s[n],MO-2);

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

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

}

LL C(int a,int b)//组合C

{

	if(a<0||b<0)

		return 1;

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

}

int main()

{

	int h,w,A,B;

	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)%MO;

		ans=(ans%MO+MO)%MO;

	}

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

	return 0;

}
// Slower C++ solution:
#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;

}

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

#include<algorithm>

using namespace std;

#define MO 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int n;

LL PowMod(LL a,int b)//快速幂

{

	LL ret=1;

	while(b)

	{

		if(b%2==1)

			ret=ret*a%MO;

		a=a*a%MO;

		b/=2;

	}

	return ret;

}

void Pre()//预处理：计算逆元

{

	s[0]=1;

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

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

	inv[0]=1;

	inv[n]=PowMod(s[n],MO-2);

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

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

}

LL C(int a,int b)//组合C

{

	if(a<0||b<0)

		return 1;

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

}

int main()

{

	int h,w,A,B;

	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)%MO;

		ans=(ans%MO+MO)%MO;

	}

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

	return 0;

}
// Slower C++ solution:
#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;

}


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

#include<algorithm>

using namespace std;

#define MO 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int n;

LL PowMod(LL a,int b)//快速幂

{

	LL ret=1;

	while(b)

	{

		if(b%2==1)

			ret=ret*a%MO;

		a=a*a%MO;

		b/=2;

	}

	return ret;

}

void Pre()//预处理：计算逆元

{

	s[0]=1;

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

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

	inv[0]=1;

	inv[n]=PowMod(s[n],MO-2);

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

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

}

LL C(int a,int b)//组合C

{

	if(a<0||b<0)

		return 1;

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

}

int main()

{

	int h,w,A,B;

	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)%MO;

		ans=(ans%MO+MO)%MO;

	}

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

	return 0;

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

using namespace std;

#define fi first

#define se second

#define pb push_back

#define mp make_pair

#define int long long

const int N = 1e5 + 5;

const int M = 1e6 + 5;

const int mod = 1e9 + 7;

typedef vector<int> vi;

typedef pair<int, int> ii;

typedef vector<ii> vii;

typedef set<int> si;

typedef map<string, int> msi;

int po(int x,int y)

{

	if(y == 0) return 1;

	int temp = po(x,y/2);

	if(y % 2 == 0) return temp * temp % mod;

	else return temp * temp % mod * x % mod;

}

int mul[2 * M], dv[2 * M];

int ckn(int k,int n)

{

	return mul[n] * dv[k] % mod * dv[n - k] % mod;

}

signed main(){

	int h, w , a , b;

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

	mul[0] = dv[0] = 1;

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

	{

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

		dv[i] = dv[i - 1] * po(i,mod -2) % mod;

	}

	int ans = 0;

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

	{

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

	}

	cout << ans;

}

	

	




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

#include<algorithm>

using namespace std;

#define MO 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int n;

LL PowMod(LL a,int b)//快速幂

{

	LL ret=1;

	while(b)

	{

		if(b%2==1)

			ret=ret*a%MO;

		a=a*a%MO;

		b/=2;

	}

	return ret;

}

void Pre()//预处理：计算逆元

{

	s[0]=1;

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

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

	inv[0]=1;

	inv[n]=PowMod(s[n],MO-2);

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

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

}

LL C(int a,int b)//组合C

{

	if(a<0||b<0)

		return 1;

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

}

int main()

{

	int h,w,A,B;

	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)%MO;

		ans=(ans%MO+MO)%MO;

	}

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

	return 0;

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

using namespace std;



long long mod=1e9+7;

long long fact[200010];

long long poww(long long a, long long b){

  long long res = 1;

  while (b){

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

    a = (a * a) % mod;

    b >>= 1;

  }

  return res;

}

long long C(long long k,long long n)

{

    return fact[n] * poww(fact[k],mod-2) % mod * poww(fact[n-k],mod-2) % mod;

}

int main()

{

    long long h,w,a,b;

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

    fact[0]=1;

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

    {

        fact[i]=fact[i-1]*i;

        fact[i]=fact[i] % mod;

    }

    //cout << C(3,5);

    long long ans=0;

    for(long long i=1;i<=w-b;i++)

    {

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

        ans=ans%mod;

    }

    cout << ans << "\n";

}


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

#include<algorithm>

using namespace std;

#define MO 1000000007

#define MAXN 200005

#define LL long long

LL inv[MAXN],s[MAXN];

int n;

LL PowMod(LL a,int b)//快速幂

{

	LL ret=1;

	while(b)

	{

		if(b%2==1)

			ret=ret*a%MO;

		a=a*a%MO;

		b/=2;

	}

	return ret;

}

void Pre()//预处理：计算逆元

{

	s[0]=1;

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

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

	inv[0]=1;

	inv[n]=PowMod(s[n],MO-2);

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

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

}

LL C(int a,int b)//组合C

{

	if(a<0||b<0)

		return 1;

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

}

int main()

{

	int h,w,A,B;

	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)%MO;

		ans=(ans%MO+MO)%MO;

	}

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

	return 0;

}