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

#define mod 1000000007

#define ll long long

using namespace std;



ll exgcd(ll a, ll b, ll & x, ll & y)

{

	if (b == 0)

	{

		x = 1;

		y = 0;

		return a;

	}

	ll d = exgcd(b, a % b, y, x);

	y -= a / b * x;

	return d;

}

ll inv(ll a, ll MOD)

{

	ll x, y;

	exgcd(a, MOD, x, y);

	x = (x % MOD + MOD) % MOD;

	return x;

}

ll fac[200010];

void init(int p)

{

	fac[0] = 1;

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

}

ll lucas2(ll n, ll m)

{

	ll ret = 1, a, b;

	while (n && m)

	{

		a = n % mod, b = m % mod;

		if (a < b) return 0;

		ret = ret * fac[a] % mod * inv(fac[b] * fac[a - b] % mod, mod) % mod;

		n /= mod, m /= mod;

	}

	return ret;

}

int main()

{

	ll x, y, n, m;



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

	ll ans = 0;

	init(200005);

	ll z = y, p = n + m - 2;

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

	{

		ans = ans + lucas2(z + i - 1, i) * lucas2(p - z - i, n - 1 - i) % mod;

		ans %= mod;

		//printf("1  %lld  %lld\n", i, ans);

	}

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

}

// Faster C++ solution for the same problem (measured speedup: 13.596911921917663x):
#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,W-i);

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

    }

    printf("%lld",Ans);

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

using namespace std;

#define int long long

int ll[200007],ff[200007];

const int mod = 1e9 + 7;



int qpow(int a,int b){

  int ret=1;

  while(b){

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

    a=(a*a)%mod;

    b>>=1;

  }

  return ret;

}





int cc(int n,int m){

  return (ff[n]*ll[m])%mod*ll[n-m]%mod;

}



int count_ways(int a,int b,int c,int d){

  int tot=(c-a)+(d-b);

  int down=(c-a);

  int ret=cc(tot,down);

  return ret;

}

main()

{

	

	int n,m,a,b;

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

	ff[0]=1; ll[0]=1;

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

	{

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

    ll[i]=qpow(ff[i],mod-2);

    }

	int tot=count_ways(1,1,n,m);

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

	{

        int tmp=count_ways(1,1,n-a,i)*count_ways(n-a+1,i,n,m)%mod;

        tot=(tot-tmp+mod)%mod;

    }

    cout<<tot<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.235827906480196x):
#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,W-i);

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

    }

    printf("%lld",Ans);

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

using namespace std;

typedef long long LL;

#define MAXN 200000

const int MOD = 1000000007;

int n, m, a, b, fac[MAXN+50]={1}, inv[MAXN+50]={1, 1};

inline int C(int n, int m)

{

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

}

int main()

{

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

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

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

    for(int i=2; i<=n+m+5; i++)

		inv[i] = (LL)(MOD-MOD/i) * inv[MOD%i] % MOD;

	for(int i=2; i<=n+m+5; i++)

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

    int ans=0;

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

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

		ans %= MOD;

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

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.210344973829723x):
#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,W-i);

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

    }

    printf("%lld",Ans);

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

#include<algorithm>

using namespace std;

#define mod 1000000007

using namespace std;

typedef long long LL;

LL je[200010];

LL x,y;

void Build()

{

	je[0]=je[1]=1;

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

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

	return;

}

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;

	Build();

    LL ans=0;

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

    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.402895036641313x):
#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,W-i);

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

    }

    printf("%lld",Ans);

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

#define MOD 1000000007

#define MAXS 200000

typedef long long LL;



int h,w,a,b,ans=0;

LL jc[MAXS+5],inv[MAXS+5];



LL Powm(LL x,LL M) {

	LL cf=x,ret=1;

	while(M) {

		if(M&1)

			ret=ret*cf%MOD;

		cf=cf*cf%MOD;

		M>>=1;

	}

	return ret;

}

void Prepare() {

	jc[0]=1;

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

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

	inv[0]=1;

	inv[MAXS]=Powm(jc[MAXS],MOD-2);

	for(LL i=MAXS-1;i>0;i--)

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

}

LL C(LL a,LL b) {

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

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

}

int main() {

	Prepare();

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

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

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

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

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 17.80824550191506x):
#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,W-i);

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

    }

    printf("%lld",Ans);

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

#define mod 1000000007

#define ll long long

using namespace std;



ll exgcd(ll a, ll b, ll & x, ll & y)

{

	if (b == 0)

	{

		x = 1;

		y = 0;

		return a;

	}

	ll d = exgcd(b, a % b, y, x);

	y -= a / b * x;

	return d;

}

ll inv(ll a, ll MOD)

{

	ll x, y;

	exgcd(a, MOD, x, y);

	x = (x % MOD + MOD) % MOD;

	return x;

}

ll fac[200010];

void init(int p)

{

	fac[0] = 1;

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

}

ll lucas2(ll n, ll m)

{

	ll ret = 1, a, b;

	while (n && m)

	{

		a = n % mod, b = m % mod;

		if (a < b) return 0;

		ret = ret * fac[a] % mod * inv(fac[b] * fac[a - b] % mod, mod) % mod;

		n /= mod, m /= mod;

	}

	return ret;

}

int main()

{

	ll x, y, n, m;



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

	ll ans = 0;

	init(200005);

	ll z = y, p = n + m - 2;

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

	{

		ans = ans + lucas2(z + i - 1, i) * lucas2(p - z - i, n - 1 - i) % mod;

		ans %= mod;

		//printf("1  %lld  %lld\n", i, ans);

	}

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

}

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

#include<algorithm>

using namespace std;

typedef long long LL; 



const LL mod=(LL)1e9+7,N=(LL)1e5;



LL fac[2*N+5]={1};



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

{

	if(!b)

	{

		x=1; y=0;

		return a;

	}

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

	LL tmp=x;

	x=y;

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

	return gcd;

}



LL C(LL n,LL m)

{

	LL x,y;

	exgcd( fac[m]*fac[n-m]%mod ,mod,x,y);

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

}



int main()

{

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

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

	

	LL w,h,a,b;

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

	

	LL ans=0;

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

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

	

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

	return 0;

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

#define MOD 1000000007

#define MAXS 200000

typedef long long LL;



int h,w,a,b,ans=0;

LL jc[MAXS+5],inv[MAXS+5];



LL Powm(LL x,LL M) {

	LL cf=x,ret=1;

	while(M) {

		if(M&1)

			ret=ret*cf%MOD;

		cf=cf*cf%MOD;

		M>>=1;

	}

	return ret;

}

void Prepare() {

	jc[0]=1;

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

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

	inv[0]=1;

	inv[MAXS]=Powm(jc[MAXS],MOD-2);

	for(LL i=MAXS-1;i>0;i--)

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

}

LL C(LL a,LL b) {

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

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

}

int main() {

	Prepare();

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

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

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

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

	return 0;

}

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

#include<algorithm>

using namespace std;

typedef long long LL; 



const LL mod=(LL)1e9+7,N=(LL)1e5;



LL fac[2*N+5]={1};



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

{

	if(!b)

	{

		x=1; y=0;

		return a;

	}

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

	LL tmp=x;

	x=y;

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

	return gcd;

}



LL C(LL n,LL m)

{

	LL x,y;

	exgcd( fac[m]*fac[n-m]%mod ,mod,x,y);

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

}



int main()

{

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

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

	

	LL w,h,a,b;

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

	

	LL ans=0;

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

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

	

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

	return 0;

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

#define MOD 1000000007

#define MAXS 200000

typedef long long LL;



int h,w,a,b,ans=0;

LL jc[MAXS+5],inv[MAXS+5];



LL Powm(LL x,LL M) {

	LL cf=x,ret=1;

	while(M) {

		if(M&1)

			ret=ret*cf%MOD;

		cf=cf*cf%MOD;

		M>>=1;

	}

	return ret;

}

void Prepare() {

	jc[0]=1;

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

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

	inv[0]=1;

	inv[MAXS]=Powm(jc[MAXS],MOD-2);

	for(LL i=MAXS-1;i>0;i--)

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

}

LL C(LL a,LL b) {

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

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

}

int main() {

	Prepare();

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

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

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

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

	return 0;

}

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

#include <math.h>

#include <string.h>

#include <algorithm>

#include <iostream>

#include <string>

#include <time.h>

#define sf scanf

#define pf printf

#define lf double

#define ll long long

#define p123 printf("123\n");

#define pn printf("\n");

#define pk printf(" ");

#define p(n) printf("%d",n);

#define pln(n) printf("%d\n",n);

#define s(n) scanf("%d",&n);

#define ss(n) scanf("%s",n);

#define ps(n) printf("%s",n);

#define sld(n) scanf("%lld",&n);

#define pld(n) printf("%lld",n);

#define slf(n) scanf("%lf",&n);

#define plf(n) printf("%lf",n);

#define sc(n) scanf("%c",&n);

#define pc(n) printf("%c",n);

#define gc getchar();

#define re(n,a) memset(n,a,sizeof(n));

#define len(a) strlen(a)

#define LL long long

using namespace std;

#include<vector>

#include<algorithm>

#include <iostream>

#include <math.h>

#define ll long long

using namespace std;

const ll mod = 1e9+7;

//快速幂

ll pow_quick(ll a,ll b){

    ll r = 1,base = a;

    while(b){

        if(b & 1){

            r *= base;

            r %= mod;

        }

        base *= base;

        base %= mod;

        b >>= 1;

    }

    return r;

}

//组合数

ll C(ll n, ll m){

    if(m > n)

        return 0;

    ll ans = 1;

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

        ll a = (n+i-m)%mod;

        ll b = i%mod;

        ans = (ans*(a*pow_quick(b,mod-2)%mod))%mod;

    }

    return ans;

}

//卢卡斯定理

ll Lucas(ll n, ll m){

    if(m == 0)

        return 1;

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

}

ll sum0 = 0;



int main(){

    ll H,W,A,B;

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

    //cout << 15*14*13*12*11*10/6/5/4/3/2/1;

    /*H--;

    W--;

    A--;

    B--;*/



    //10 7 3 4

    //Lucas(H-A+i-2,H-A-1)*Lucas(W-i+A-1,A-1

    //流泪 sum = Lucas(H+W,H);

    ll a = Lucas(H-A+(B+1)-2,H-A-1);

    ll b = Lucas(W-(B+1)+A-1,A-1);

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

        sum0 += (a*b)%mod;

        sum0 %= mod;

        a *= (H-A+i-2+1);

        a %= mod;

        a *= pow_quick(H-A+i-2-(H-A-1)+1,mod-2);

        a %= mod;

        b *= W-i+A-1-(A-1);

        b %= mod;

        b *= pow_quick(W-i+A-1,mod-2);

        b %= mod;

        //pld(i) pn

        /*if(i % 10 == 0){

            pld(i) pn

        }*/

    }

    /*sum0 += (a*b)%mod;

    sum0 %= mod*/

    cout << (sum0+mod)%mod;





    return 0;

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

#include<algorithm>

using namespace std;

typedef long long LL; 



const LL mod=(LL)1e9+7,N=(LL)1e5;



LL fac[2*N+5]={1};



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

{

	if(!b)

	{

		x=1; y=0;

		return a;

	}

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

	LL tmp=x;

	x=y;

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

	return gcd;

}



LL C(LL n,LL m)

{

	LL x,y;

	exgcd( fac[m]*fac[n-m]%mod ,mod,x,y);

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

}



int main()

{

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

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

	

	LL w,h,a,b;

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

	

	LL ans=0;

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

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

	

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

	return 0;

}

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

#include <math.h>

#include <string.h>

#include <algorithm>

#include <iostream>

#include <string>

#include <time.h>

#define sf scanf

#define pf printf

#define lf double

#define ll long long

#define p123 printf("123\n");

#define pn printf("\n");

#define pk printf(" ");

#define p(n) printf("%d",n);

#define pln(n) printf("%d\n",n);

#define s(n) scanf("%d",&n);

#define ss(n) scanf("%s",n);

#define ps(n) printf("%s",n);

#define sld(n) scanf("%lld",&n);

#define pld(n) printf("%lld",n);

#define slf(n) scanf("%lf",&n);

#define plf(n) printf("%lf",n);

#define sc(n) scanf("%c",&n);

#define pc(n) printf("%c",n);

#define gc getchar();

#define re(n,a) memset(n,a,sizeof(n));

#define len(a) strlen(a)

#define LL long long

using namespace std;

#include<vector>

#include<algorithm>

#include <iostream>

#include <math.h>

#define ll long long

using namespace std;

const ll mod = 1e9+7;

//快速幂

ll pow_quick(ll a,ll b){

    ll r = 1,base = a;

    while(b){

        if(b & 1){

            r *= base;

            r %= mod;

        }

        base *= base;

        base %= mod;

        b >>= 1;

    }

    return r;

}

//组合数

ll C(ll n, ll m){

    if(m > n)

        return 0;

    ll ans = 1;

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

        ll a = (n+i-m)%mod;

        ll b = i%mod;

        ans = (ans*(a*pow_quick(b,mod-2)%mod))%mod;

    }

    return ans;

}

//卢卡斯定理

ll Lucas(ll n, ll m){

    if(m == 0)

        return 1;

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

}

ll sum0 = 0;



int main(){

    ll H,W,A,B;

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

    //cout << 15*14*13*12*11*10/6/5/4/3/2/1;

    /*H--;

    W--;

    A--;

    B--;*/



    //10 7 3 4

    //Lucas(H-A+i-2,H-A-1)*Lucas(W-i+A-1,A-1

    //流泪 sum = Lucas(H+W,H);

    ll a = Lucas(H-A+(B+1)-2,H-A-1);

    ll b = Lucas(W-(B+1)+A-1,A-1);

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

        sum0 += (a*b)%mod;

        sum0 %= mod;

        a *= (H-A+i-2+1);

        a %= mod;

        a *= pow_quick(H-A+i-2-(H-A-1)+1,mod-2);

        a %= mod;

        b *= W-i+A-1-(A-1);

        b %= mod;

        b *= pow_quick(W-i+A-1,mod-2);

        b %= mod;

        //pld(i) pn

        /*if(i % 10 == 0){

            pld(i) pn

        }*/

    }

    /*sum0 += (a*b)%mod;

    sum0 %= mod*/

    cout << (sum0+mod)%mod;





    return 0;

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

using namespace std;



int main()

{

  int N, dp[1 << 16];



  while(cin >> N, N) {

    memset(dp, 0, sizeof(dp));

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

      int M, L;

      cin >> M >> L;

      int bitMask = 0;

      while(M--) {

        int S, E;

        cin >> S >> E;

        S -= 6, E -= 6;

        bitMask |= (1 << E) - (1 << S);

      }

      for(int j = 0; j < 1 << 16; j++) {

        if(!(bitMask & j)) {

          dp[bitMask | j] = max(dp[bitMask | j], dp[j] + L);

        }

      }

    }

    cout << dp[(1 << 16) - 1] << endl;

  }

}

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

using namespace std;



int main()

{

  int N, K[100], L[100], dp[1 << 16];



  while(cin >> N, N) {

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

      int M;

      cin >> M >> L[i];

      K[i] = 0;

      while(M--) {

        int S, E;

        cin >> S >> E;

        S -= 6, E -= 6;

        K[i] |= (1 << E) - (1 << S);

      }

    }

    memset(dp, -1, sizeof(dp));

    dp[0] = 0;

    int ret = 0;

    for(int j = 0; j < 1 << 16; j++) {

      if(~dp[j]) {

        ret = max(ret, dp[j]);

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

          if(!(K[i] & j)) {

            dp[K[i] | j] = max(dp[K[i] | j], dp[j] + L[i]);

          }

        }

      }

    }

    cout << ret << endl;

  }

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

using namespace std;



int main()

{

  int N, dp[1 << 16];



  while(cin >> N, N) {

    memset(dp, 0, sizeof(dp));

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

      int M, L;

      cin >> M >> L;

      int bitMask = 0;

      while(M--) {

        int S, E;

        cin >> S >> E;

        S -= 6, E -= 6;

        bitMask |= (1 << E) - (1 << S);

      }

      for(int j = 0; j < 1 << 16; j++) {

        if(!(bitMask & j)) {

          dp[bitMask | j] = max(dp[bitMask | j], dp[j] + L);

        }

      }

    }

    cout << dp[(1 << 16) - 1] << endl;

  }

}

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

using namespace std;



int main()

{

  int N, K[100], L[100], dp[1 << 16];



  while(scanf("%d", &N), N) {

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

      int M;

      scanf("%d %d", &M, L + i);

      K[i] = 0;

      while(M--) {

        int S, E;

        cin >> S >> E;

        S -= 6, E -= 6;

        K[i] |= (1 << E) - (1 << S);

      }

    }

    memset(dp, -1, sizeof(dp));

    dp[0] = 0;

    int ret = 0;

    for(int j = 0; j < 1 << 16; j++) {

      if(~dp[j]) {

        ret = max(ret, dp[j]);

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

          if(!(K[i] & j)) {

            dp[K[i] | j] = max(dp[K[i] | j], dp[j] + L[i]);

          }

        }

      }

    }

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

  }

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)

#define rep(i,n) repd(i,0,n)

//#define int long long

typedef long long ll;

using namespace std;

const int MOD = 1000000007;

const int INF = 1010000000;

const double EPS = 1e-10;

const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 



signed main(){

  int n;cin>>n;int a[100000], b[100000];pair<int,int> c[100000];

  rep(i,n){

    cin>>a[i]>>b[i];

    c[i] = make_pair(a[i]+b[i], i);

  }

  sort(c,c+n,greater<pair<int,int>>());

  ll ans = 0;

  rep(i,n){

    if(!(i%2)){

      ans += a[c[i].second];

    }else{

      ans -= b[c[i].second];

    }

  }

  cout << ans << endl;

}


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

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);i++)

#define rep(i,n) repd(i,0,n)

typedef long long ll;

typedef long double lb;

#define int long long

#define double long double

#define endn "\n"

typedef pair<int,int> P;

const int MOD = 1000000007;

const ll INF = 1e16;

const double EPS = 1e-10;

const double PI = 3.141592653589793;

template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}

template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}

const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 





////////////////////////////////////////////////////////////////////



int n;P p[210000], q[210000];

signed main(){

  cin>>n;rep(i,n)cin>>p[i].first>>p[i].second;

  sort(p,p+n);

  rep(i,n){

    q[i].first = p[i].first + p[i].second;

    q[i].second = i;

  }

  sort(q,q+n, greater<P>());

  int ans = 0;

  rep(i,n){

    int t = q[i].second;

    if(i%2 == 0){

      ans += p[t].first;

    }else{

      ans -= p[t].second;

    }

  }

  cout << ans << endl;

}