stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std; 



const int N=200010, P=(int)1e9+7;

int n, m, A, B;

int f[N];

 

int pow(int x, int t){

	int ans = 1;

	for(; t; t>>=1, x=x*1ll*x%P) if(t&1) ans=ans*1ll*x%P;

	return ans;

}



int C(int n, int m){

	return pow(f[m]*1ll*f[n-m]%P, P-2) *1ll*f[n]%P;

}



int main(){

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

	if(A==n || B==m){ puts("0"); return 0; }

	int t1 = n+m-2; 

	f[0] = 1; for(int i=1; i<=t1; ++i) f[i]=f[i-1]*1ll*i%P;

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

	for(int i=n-A+1, j=A; i<=n; ++i, --j){

		ans -= C(i+B-2, B-1)*1ll*C(j+m-B-2, m-B-1)%P;

		if(ans<0) ans+=P;

	}

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

}


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

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define MAXN 500005

#define mod 1000000007ll



long long f[MAXN]={1ll};



long long power(long long x,long long p){

	if(p==1ll) return x%mod;

	if(p==0ll) return 0ll;

	long long t=power(x,p/2ll);

	if(p&1ll) return t*t%mod*x%mod;

	else return t*t%mod;

}



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

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

	if(n<m) return 0ll;

	return f[n]*power(f[m],mod-2ll)%mod*power(f[n-m],mod-2ll)%mod;

}



long long n,m;

long long a,b;

int main(){

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

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

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

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

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

	long long i=n-a+1,j=b;

	while(i<=n&&j>=1){

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

		i++;j--;

	}

	printf("%lld",ans);

	system("pause");

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

typedef long long ll;

const int mod=1e9+7;

const int N=200010;

ll f[N];

ll qpow(ll a,int b){

	ll ans=1;

	while(b){

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

		a=a*a%mod;

		b>>=1ll; 

	}

	return ans;

}

ll C(ll a,ll b){

	return f[a]*qpow(f[b]*f[a-b]%mod,mod-2)%mod;

}

int main(){

	int n,m,a,b;

	ll ans=0;

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

	if(n==a||b==m) {

		puts("0");return 0;

	}

	f[0]=1;

	for(int i=1;i<=n+m;i++) f[i]=f[i-1]*i%mod;

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

	

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

	ans=(ans-C(n-a+i+b-2,b-1)*C(a-i+1+m-b-2, m-b-1)%mod+mod)%mod;    //   -(...)*C(A-i+1+m-B-2, m-B-1) 

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

	return 0;

}


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

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define MAXN 500005

#define mod 1000000007ll



long long f[MAXN]={1ll};



long long power(long long x,long long p){

	if(p==1ll) return x%mod;

	if(p==0ll) return 0ll;

	long long t=power(x,p/2ll);

	if(p&1ll) return t*t%mod*x%mod;

	else return t*t%mod;

}



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

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

	if(n<m) return 0ll;

	return f[n]*power(f[m],mod-2ll)%mod*power(f[n-m],mod-2ll)%mod;

}



long long n,m;

long long a,b;

int main(){

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

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

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

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

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

	long long i=n-a+1,j=b;

	while(i<=n&&j>=1){

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

		i++;j--;

	}

	printf("%lld",ans);

	system("pause");

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

using namespace std;

# define lowbit(x) ((x)&(-x))

# define pi acos(-1.0)

# define eps 1e-8

# define MOD 1000000007

# define INF 1000000000

# define mem(a,b) memset(a,b,sizeof(a))

# define FOR(i,a,n) for(register int i=a; i<=n; ++i)

# define FDR(i,a,n) for(register int i=a; i>=n; --i)

# define AU(i,x)    for(auto i=x.begin(); i!=x.end(); ++i)

# define ALL(A) A.begin(),A.end()

# define bug puts("H");

# define lch p<<1,l,mid

# define rch p<<1|1,mid+1,r

# define mp make_pair

# define pb push_back

typedef pair<int,int> PII;

typedef vector<int> VI;

# pragma comment(linker, "/STACK:1024000000,1024000000")

typedef long long LL;

inline char nc(){

    static char buf[1000000],*p1=buf,*p2=buf;

    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;

}

inline int Scan(){

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

    if (ch=='-') f=-1, ch=nc();

    while(!(ch>='0'&&ch<='9'))ch=nc();

    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();

    return sum*f;

}

int ps4[4][2]={0,1,0,-1,1,0,-1,0};

int ps8[8][2]={0,1,0,-1,1,0,-1,0,1,1,1,-1,-1,-1,-1,1};

inline int min(int a,int b,int c) {return min(a,min(b,c));}

inline int max(int a,int b,int c) {return max(a,max(b,c));}

inline int min(int a,int b,int c,int d){return min(min(a,b,c),d);}

inline int max(int a,int b,int c,int d){return max(max(a,b,c),d);}

//struct Edge{int p, next, w;}edge[maxn];

//inline add_edge(int u, int v, int w){edge[cnt]=Edge{v,head[u],w}; head[u]=cnt++;}

const int N=200005;

///Code begin..................................................................



LL A[N];



LL pow_mod(LL a, LL n, LL mod){

    LL ret=1, tmp=a%mod;

    while (n) {

        if (n&1) ret=ret*tmp%MOD;

        tmp=tmp*tmp%MOD;

        n>>=1;

    }

    return ret;

}

LL inv(LL a, LL mod){return pow_mod(a,mod-2,mod);}

void init(){

    A[0]=1; FOR(i,1,N-1) A[i]=A[i-1]*i%MOD;

}

LL C(int x, int y){

    return A[y]*inv(A[x]*A[y-x]%MOD,MOD)%MOD;

}

int main ()

{

    init();

    int H, W, A, B;

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

    LL ans=0;

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

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

    return 0;

}


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

using namespace std;

#define ll long long

const ll mod=1e9+7;

ll n, m, a, b, s;

ll f[1000005];

pair<ll,ll> exgcd(ll a, ll b){

	if(b==0) return {1, 0};

	auto p=exgcd(b, a%b);

	return {p.second, p.first-a/b*p.second};

}

ll inv(ll x){

	auto p=exgcd(x, mod);

	return (p.first%mod+mod)%mod;

}

ll C(ll p, ll q){

	return f[p]*inv(f[q])%mod*inv(f[p-q])%mod;

}

int main(){

	cin>>n>>m>>a>>b;

	f[0]=1;

	for(int i=1;i<=m+n;i++) f[i]=(f[i-1]*i)%mod;

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

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

		s=s%mod;

	}

	cout<<s;

	//i, b

	//i+b-1, b-1

	//n-i-1, m-b

	//m+n-b-i-2, m-b-1

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

using namespace std;

# define lowbit(x) ((x)&(-x))

# define pi acos(-1.0)

# define eps 1e-8

# define MOD 1000000007

# define INF 1000000000

# define mem(a,b) memset(a,b,sizeof(a))

# define FOR(i,a,n) for(register int i=a; i<=n; ++i)

# define FDR(i,a,n) for(register int i=a; i>=n; --i)

# define AU(i,x)    for(auto i=x.begin(); i!=x.end(); ++i)

# define ALL(A) A.begin(),A.end()

# define bug puts("H");

# define lch p<<1,l,mid

# define rch p<<1|1,mid+1,r

# define mp make_pair

# define pb push_back

typedef pair<int,int> PII;

typedef vector<int> VI;

# pragma comment(linker, "/STACK:1024000000,1024000000")

typedef long long LL;

inline char nc(){

    static char buf[1000000],*p1=buf,*p2=buf;

    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;

}

inline int Scan(){

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

    if (ch=='-') f=-1, ch=nc();

    while(!(ch>='0'&&ch<='9'))ch=nc();

    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();

    return sum*f;

}

int ps4[4][2]={0,1,0,-1,1,0,-1,0};

int ps8[8][2]={0,1,0,-1,1,0,-1,0,1,1,1,-1,-1,-1,-1,1};

inline int min(int a,int b,int c) {return min(a,min(b,c));}

inline int max(int a,int b,int c) {return max(a,max(b,c));}

inline int min(int a,int b,int c,int d){return min(min(a,b,c),d);}

inline int max(int a,int b,int c,int d){return max(max(a,b,c),d);}

//struct Edge{int p, next, w;}edge[maxn];

//inline add_edge(int u, int v, int w){edge[cnt]=Edge{v,head[u],w}; head[u]=cnt++;}

const int N=200005;

///Code begin..................................................................



LL A[N];



LL pow_mod(LL a, LL n, LL mod){

    LL ret=1, tmp=a%mod;

    while (n) {

        if (n&1) ret=ret*tmp%MOD;

        tmp=tmp*tmp%MOD;

        n>>=1;

    }

    return ret;

}

LL inv(LL a, LL mod){return pow_mod(a,mod-2,mod);}

void init(){

    A[0]=1; FOR(i,1,N-1) A[i]=A[i-1]*i%MOD;

}

LL C(int x, int y){

    return A[y]*inv(A[x]*A[y-x]%MOD,MOD)%MOD;

}

int main ()

{

    init();

    int H, W, A, B;

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

    LL ans=0;

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

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

    return 0;

}


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

#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<algorithm>

#define mod 1000000007

using namespace std;

long long n,m,a,b,ans;

long long fac[1000005];

long long qpow(long long base,long long t)

{

	long long ret=1;

	while(t)

	{

		if(t&1) ret=ret*base%mod;

		base=base*base%mod;

		t>>=1;

	}



	return ret;

}

long long C(long long N,long long M)

{

	if(!M) return 1;

	if(N<M) return 0;

  	return fac[N]*qpow(fac[M],mod-2)%mod*qpow(fac[N-M],mod-2)%mod;

}

long long solve(long long h,long long w)

{

	return C(h+w-2,h-1);

}

int main()

{

	int i,j;

	long long A,B,C,D,t1,t2,t;

	cin>>n>>m>>a>>b;

	fac[0]=1;

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

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

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

	{

		t=solve(n-a,i)*solve(a,m-i+1)%mod;

		ans=(ans+t)%mod;

	}

	cout<<ans<<endl;

	return 0;

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

using namespace std;



typedef long long LL;



const int N = 3e5;

const LL MOD = 1e9+7;



inline LL dmod(LL x){

	return x%MOD;

}



LL fakto[N+5];



void pre(){

	fakto[0] = 1LL;

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

		fakto[i] = dmod(fakto[i-1]*(LL)(i));

	}

	return;

}



LL fe(LL x, LL y){

	if(y==0) return 1LL;

	LL ret = fe(x,y/2);

	ret = dmod(ret*ret);

	if(y&1){

		ret = dmod(ret*x);

	}

	return ret;

}



LL nCr(LL x, LL y){

	LL tmp = dmod(fakto[y]*fakto[x-y]);

	tmp = fe(tmp,MOD-2);

	tmp = dmod(tmp*fakto[x]);

	return tmp;

}



LL step(int x, int y, int a, int b){

	int dx = a-x;

	int dy = b-y;

	int tot = dx+dy;

	return nCr(tot,dx);

}



int h,w,a,b;

int main(){

	pre();

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

	LL ret = 0LL;

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

		LL tmp = step(1,1,i,b);

		tmp = dmod(tmp*step(i,b+1,h,w));

		ret = dmod(ret+tmp);

	}

	cout << ret << endl;

	return 0;

}

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

#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<algorithm>

#define mod 1000000007

using namespace std;

long long n,m,a,b,ans;

long long fac[1000005];

long long qpow(long long base,long long t)

{

	long long ret=1;

	while(t)

	{

		if(t&1) ret=ret*base%mod;

		base=base*base%mod;

		t>>=1;

	}



	return ret;

}

long long C(long long N,long long M)

{

	if(!M) return 1;

	if(N<M) return 0;

  	return fac[N]*qpow(fac[M],mod-2)%mod*qpow(fac[N-M],mod-2)%mod;

}

long long solve(long long h,long long w)

{

	return C(h+w-2,h-1);

}

int main()

{

	int i,j;

	long long A,B,C,D,t1,t2,t;

	cin>>n>>m>>a>>b;

	fac[0]=1;

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

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

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

	{

		t=solve(n-a,i)*solve(a,m-i+1)%mod;

		ans=(ans+t)%mod;

	}

	cout<<ans<<endl;

	return 0;

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

using namespace std;

//#include<ext/rope>

//using namespace __gnu_cxx

//#include<ext/pb_ds/priority_queue.hpp>

//using namespace __gnu_pbds;

#define lowbit(x) (x&-x)

#define pb push_back

#define empb emplace_back

#define all(x) (x).begin(),(x).end()

#define clr(a,b) memset(a,b,sizeof(a))

#define caze(T) for(cin>>T;T;T--)

#define inf (1<<29)

#define Endl ('\n')

#define fi first

#define se second

#define db double

#define ldb long double

#define ll long long

#define pii pair<int,int>

#define pil pair<int,ll>

#define pli pair<ll,int>

#define pll pair<ll,ll>

#define ull unsigned long long

#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

inline char nc() {

	#define SZ 1000000

	static char buf[SZ], *p1, *p2;

	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;

}

template<typename T>

inline int scan(T &x) {

	char c, sign=1; 

	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;

	if(c==EOF) return EOF;

	for(x = 0; isdigit(c); c = nc())

		x = (x<<1) + (x<<3) + (c&15);

	return x *= sign, 1;

}

template<typename T, typename...Args>

inline int scan(T &x, Args&...args) {

	return scan(x), scan(args...);

}

const int N=1<<18;

const int mod=1000000007;

int f[N],ivf[N];

int qp(int a,int b)

{

	int ret=1;

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

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

	return ret;

}

int C(int n,int m){int ret=1LL*f[n]*ivf[n-m]%mod;return 1LL*ret*ivf[m]%mod;}

int go(int n,int m){return C(n+m-2,m-1);}

int main()

{

	f[0]=1;

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

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

	ivf[N-1]=qp(f[N-1],mod-2);

	for(int i=N-2;~i;--i)

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

	int n,m,a,b;

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

	{

		int ans=0;

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

		{

			int tp=1LL*go(i,b)*go(n-i+1,m-b)%mod;

			(ans+=tp)%=mod;

		}

		cout<<ans<<Endl;

	}

}

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

#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<algorithm>

#define mod 1000000007

using namespace std;

long long n,m,a,b,ans;

long long fac[1000005];

long long qpow(long long base,long long t)

{

	long long ret=1;

	while(t)

	{

		if(t&1) ret=ret*base%mod;

		base=base*base%mod;

		t>>=1;

	}



	return ret;

}

long long C(long long N,long long M)

{

	if(!M) return 1;

	if(N<M) return 0;

  	return fac[N]*qpow(fac[M],mod-2)%mod*qpow(fac[N-M],mod-2)%mod;

}

long long solve(long long h,long long w)

{

	return C(h+w-2,h-1);

}

int main()

{

	int i,j;

	long long A,B,C,D,t1,t2,t;

	cin>>n>>m>>a>>b;

	fac[0]=1;

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

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

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

	{

		t=solve(n-a,i)*solve(a,m-i+1)%mod;

		ans=(ans+t)%mod;

	}

	cout<<ans<<endl;

	return 0;

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

using namespace std;



typedef long long LL;



const int N = 3e5;

const LL MOD = 1e9+7;



inline LL dmod(LL x){

	return x%MOD;

}



LL fakto[N+5];



void pre(){

	fakto[0] = 1LL;

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

		fakto[i] = dmod(fakto[i-1]*(LL)(i));

	}

	return;

}



LL fe(LL x, LL y){

	if(y==0) return 1LL;

	LL ret = fe(x,y/2);

	ret = dmod(ret*ret);

	if(y&1){

		ret = dmod(ret*x);

	}

	return ret;

}



LL nCr(LL x, LL y){

	LL tmp = dmod(fakto[y]*fakto[x-y]);

	tmp = fe(tmp,MOD-2);

	tmp = dmod(tmp*fakto[x]);

	return tmp;

}



LL step(int x, int y, int a, int b){

	int dx = a-x;

	int dy = b-y;

	int tot = dx+dy;

	return nCr(tot,dx);

}



int h,w,a,b;

int main(){

	pre();

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

	LL ret = 0LL;

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

		LL tmp = step(1,1,i,b);

		tmp = dmod(tmp*step(i,b+1,h,w));

		ret = dmod(ret+tmp);

	}

	cout << ret << endl;

	return 0;

}

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

typedef long long ll;

using namespace std;

const int N = 2e5 + 7;

const int mod = 1e9+7;

ll jc[N];

void init()

{

    jc[0]=1;

    jc[1]=1;

    for(int i=2;i<=N-2;i++){

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

    }

}

ll qp(ll a,ll b)

{

    ll ret=1;

    while(b){

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

        a = a*a %mod;

        b>>=1;

    }return ret;

}

ll c(ll n,ll m)

{

    return jc[n]* qp(jc[m]*jc[n-m]%mod,mod-2) %mod;

}

int main()

{

    init();

    ll n,m,a,b,ans=0;

    cin>>n>>m>>a>>b;

    ll d=b+n-1-a;

    ll d2=n+m-2-d;

    if(n-a<=m-b){

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

            ans = ans + c(d,i)*c(d2,n-1-i)%mod;

            ans%=mod;

        }

    }

    else{

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

            ans = ans + c(d,m-1-i)*c(d2,i)%mod;

            ans%=mod;

        }

    }

    cout<<ans<<endl;

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

using namespace std;

//#include<ext/rope>

//using namespace __gnu_cxx

//#include<ext/pb_ds/priority_queue.hpp>

//using namespace __gnu_pbds;

#define lowbit(x) (x&-x)

#define pb push_back

#define empb emplace_back

#define all(x) (x).begin(),(x).end()

#define clr(a,b) memset(a,b,sizeof(a))

#define caze(T) for(cin>>T;T;T--)

#define inf (1<<29)

#define Endl ('\n')

#define fi first

#define se second

#define db double

#define ldb long double

#define ll long long

#define pii pair<int,int>

#define pil pair<int,ll>

#define pli pair<ll,int>

#define pll pair<ll,ll>

#define ull unsigned long long

#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

inline char nc() {

	#define SZ 1000000

	static char buf[SZ], *p1, *p2;

	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;

}

template<typename T>

inline int scan(T &x) {

	char c, sign=1; 

	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;

	if(c==EOF) return EOF;

	for(x = 0; isdigit(c); c = nc())

		x = (x<<1) + (x<<3) + (c&15);

	return x *= sign, 1;

}

template<typename T, typename...Args>

inline int scan(T &x, Args&...args) {

	return scan(x), scan(args...);

}

const int N=1<<18;

const int mod=1000000007;

int f[N],ivf[N];

int qp(int a,int b)

{

	int ret=1;

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

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

	return ret;

}

int C(int n,int m){int ret=1LL*f[n]*ivf[n-m]%mod;return 1LL*ret*ivf[m]%mod;}

int go(int n,int m){return C(n+m-2,m-1);}

int main()

{

	f[0]=1;

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

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

	ivf[N-1]=qp(f[N-1],mod-2);

	for(int i=N-2;~i;--i)

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

	int n,m,a,b;

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

	{

		int ans=0;

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

		{

			int tp=1LL*go(i,b)*go(n-i+1,m-b)%mod;

			(ans+=tp)%=mod;

		}

		cout<<ans<<Endl;

	}

}

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

typedef long long ll;

using namespace std;

const int N = 2e5 + 7;

const int mod = 1e9+7;

ll jc[N];

void init()

{

    jc[0]=1;

    jc[1]=1;

    for(int i=2;i<=N-2;i++){

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

    }

}

ll qp(ll a,ll b)

{

    ll ret=1;

    while(b){

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

        a = a*a %mod;

        b>>=1;

    }return ret;

}

ll c(ll n,ll m)

{

    return jc[n]* qp(jc[m]*jc[n-m]%mod,mod-2) %mod;

}

int main()

{

    init();

    ll n,m,a,b,ans=0;

    cin>>n>>m>>a>>b;

    ll d=b+n-1-a;

    ll d2=n+m-2-d;

    if(n-a<=m-b){

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

            ans = ans + c(d,i)*c(d2,n-1-i)%mod;

            ans%=mod;

        }

    }

    else{

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

            ans = ans + c(d,m-1-i)*c(d2,i)%mod;

            ans%=mod;

        }

    }

    cout<<ans<<endl;

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

using namespace std;



typedef long long LL;



const int N = 3e5;

const LL MOD = 1e9+7;



inline LL dmod(LL x){

	return x%MOD;

}



LL fakto[N+5];



void pre(){

	fakto[0] = 1LL;

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

		fakto[i] = dmod(fakto[i-1]*(LL)(i));

	}

	return;

}



LL fe(LL x, LL y){

	if(y==0) return 1LL;

	LL ret = fe(x,y/2);

	ret = dmod(ret*ret);

	if(y&1){

		ret = dmod(ret*x);

	}

	return ret;

}



LL nCr(LL x, LL y){

	LL tmp = dmod(fakto[y]*fakto[x-y]);

	tmp = fe(tmp,MOD-2);

	tmp = dmod(tmp*fakto[x]);

	return tmp;

}



LL step(int x, int y, int a, int b){

	int dx = a-x;

	int dy = b-y;

	int tot = dx+dy;

	return nCr(tot,dx);

}



int h,w,a,b;

int main(){

	pre();

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

	LL ret = 0LL;

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

		LL tmp = step(1,1,i,b);

		tmp = dmod(tmp*step(i,b+1,h,w));

		ret = dmod(ret+tmp);

	}

	cout << ret << endl;

	return 0;

}

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

#include<string.h>

#include<vector>

#include<algorithm>

using namespace std;

#define ll long long 

#define ull unsigned long long

#define pb push_back

const int maxn = 200005;

const ll mod = 1000000007;

ll f[maxn], 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 a = f[n];

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

	return (a * powmod(b, mod - 2)) % mod;

}

int main()

{

	f[0] = 1;

	for (ll i = 1; i < maxn; i++)

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

	cin >> n >> m >> A >> B;

		ll ans = 0;

		for (ll i = B + 1; i <= m; i++)

		{

			ll t = (C(i - 1 + n - A - 1, n - A - 1) * C(m - i + A - 1, m - i)) % mod;

			ans = (ans + t) % mod;

		}

		cout << ans << endl;

	return 0;

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

using namespace std;

//#include<ext/rope>

//using namespace __gnu_cxx

//#include<ext/pb_ds/priority_queue.hpp>

//using namespace __gnu_pbds;

#define lowbit(x) (x&-x)

#define pb push_back

#define empb emplace_back

#define all(x) (x).begin(),(x).end()

#define clr(a,b) memset(a,b,sizeof(a))

#define caze(T) for(cin>>T;T;T--)

#define inf (1<<29)

#define Endl ('\n')

#define fi first

#define se second

#define db double

#define ldb long double

#define ll long long

#define pii pair<int,int>

#define pil pair<int,ll>

#define pli pair<ll,int>

#define pll pair<ll,ll>

#define ull unsigned long long

#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

inline char nc() {

	#define SZ 1000000

	static char buf[SZ], *p1, *p2;

	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;

}

template<typename T>

inline int scan(T &x) {

	char c, sign=1; 

	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;

	if(c==EOF) return EOF;

	for(x = 0; isdigit(c); c = nc())

		x = (x<<1) + (x<<3) + (c&15);

	return x *= sign, 1;

}

template<typename T, typename...Args>

inline int scan(T &x, Args&...args) {

	return scan(x), scan(args...);

}

const int N=1<<18;

const int mod=1000000007;

int f[N],ivf[N];

int qp(int a,int b)

{

	int ret=1;

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

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

	return ret;

}

int C(int n,int m){int ret=1LL*f[n]*ivf[n-m]%mod;return 1LL*ret*ivf[m]%mod;}

int go(int n,int m){return C(n+m-2,m-1);}

int main()

{

	f[0]=1;

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

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

	ivf[N-1]=qp(f[N-1],mod-2);

	for(int i=N-2;~i;--i)

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

	int n,m,a,b;

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

	{

		int ans=0;

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

		{

			int tp=1LL*go(i,b)*go(n-i+1,m-b)%mod;

			(ans+=tp)%=mod;

		}

		cout<<ans<<Endl;

	}

}

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

#include<string.h>

#include<vector>

#include<algorithm>

using namespace std;

#define ll long long 

#define ull unsigned long long

#define pb push_back

const int maxn = 200005;

const ll mod = 1000000007;

ll f[maxn], 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 a = f[n];

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

	return (a * powmod(b, mod - 2)) % mod;

}

int main()

{

	f[0] = 1;

	for (ll i = 1; i < maxn; i++)

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

	cin >> n >> m >> A >> B;

		ll ans = 0;

		for (ll i = B + 1; i <= m; i++)

		{

			ll t = (C(i - 1 + n - A - 1, n - A - 1) * C(m - i + A - 1, m - i)) % mod;

			ans = (ans + t) % mod;

		}

		cout << ans << endl;

	return 0;

}