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

using namespace std;



typedef long long vlong;

const int maxn = 55;



int a[maxn];

vlong dp[maxn][101*101], p, n;



vlong knap(int i, int tmp){

	if(i >= n){

		if(tmp % 2 == p)return 1;

		

		else{

			return 0;

		}

	}

	if(dp[i][tmp] == -1){

		vlong ret1 = 0, ret2 = 0;

		ret1 = knap(i+1, a[i]+tmp);

		ret2 = knap(i+1, tmp);

		dp[i][tmp] = ret1 + ret2;

	}

	return dp[i][tmp];

}



int main(int argc, char const *argv[])

{

	cin >> n >> p;

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

		cin >> a[i];



	memset(dp, -1, sizeof dp);

	cout << knap(0, 0) << endl;

}


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

#include <cmath>

using namespace std;



void solve(long long even , long long odd , long long p , long long n){

	long long ans = 0; 

	if(even == n){

		if(p == 0){

			ans = pow(2 , n);

		}

		else if(p == 1){

			ans = 0;

		}

	}

	else{

		ans = pow(2 , n-1);

	}

	cout << ans << endl; 

}



int main(){

	long long n , p; 

	cin >> n >> p;



	long long num;

	long long even = 0; 

	long long odd = 0; 

	for(long long i = 0; i < n; i++){

		cin >> num;

		if(num % 2 == 0){

			even++;

		}

		else{

			odd++;

		}

	}

	solve(even , odd , p , n);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
  ///====================== khela STARTS HERE =====================///

#include "bits/stdc++.h"

const int inf = 1000000005;

const long long INF = 3e18;

const double pi = 2 * acos ( 0.0 );

typedef long long ll;

#define pii pair<int, int>

#define pb push_back

#define pf push_front

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

#define maximum *max_element

#define minimum *min_element

#define MEMSET(v, x) memset(v, x, sizeof(v))

#define ABS(x) ((x)<0?-(x):(x))

#define white 1

#define grey 2

#define black 3

#define bug cout << "ei porjonto thikase" << endl;

#define fastread ios_base::sync_with_stdio(false);cin.tie(0);

using namespace std;

int gcd (int a, int b ) {

    a =  abs( a ); b = abs( b );

    while ( b ) { a = a % b; swap ( a, b ); } return a;}

int modInverse(int a, int m)

{int m0 = m;int y = 0, x = 1;if (m == 1)return 0;

while (a > 1){int q = a / m;int t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}

int lcm(int a, int b)

{int temp = gcd(a, b);return temp ? (a / temp * b) : 0;}

///====================== khela end1s HERE =====================///

const int maxn = 55;

int arr[maxn];

ll dp[maxn][101*101], p, n;

ll call(int i, int ammount){

	if(i>=n){

		if(ammount%2 == p)return 1;

		else{

			return 0;

		}

	}

	if(dp[i][ammount] == -1){

		ll ret1 = 0, ret2 = 0;

		ret1 = call(i+1, arr[i]+ammount);

		ret2 = call(i+1, ammount);

		dp[i][ammount] = ret1 + ret2;

	}

	return dp[i][ammount];

}



int main(int argc, char const *argv[])

{

	cin >> n >> p;

	for(int i=0; i<n; i++)cin >> arr[i];

	MEMSET(dp, -1);

	cout << call(0, 0) << endl;

}

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



using namespace std;



int bisc[2];



long long perm(int a){

    int pangkat = 1;

    if (a == 1) return 1;

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

        pangkat*=2;

    }

    return perm(a-1) + pangkat;

}



int main(){

    int N, P;

    cin >> N >> P;

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

        int biscuits;

        cin >> biscuits;

        bisc[biscuits % 2]++;

    }

    long long ans = 1;

    for(int i=1; i<=bisc[0] ; i++) ans*=2;

    ans--;

    if(bisc[1] > 1){

        ans +=  ans*(perm(bisc[1] - 1)) + perm(bisc[1] - 1) ;

    }

    ans++;

    if (P == 0){

        cout << ans << endl;

    } else{

        long long pangkat = 1;

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

            pangkat*=2;

        }

        cout << pangkat - ans << endl;

    }

}

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

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

#define LEN(x) (int)x.size()

#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)

using namespace std;

typedef int64_t i64;

typedef pair<int,int> pii;

template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}

template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;



int N, P;

int a[105];



i64 dp[55][55 * 105];



i64 slv(int i, int sum)

{

  if (i >= N) { return ((sum & 1) == P) ? 1 : 0; }

  i64 &ret = dp[i][sum];

  if (~ret) { return ret; }



  return ret = slv(i+1,sum) + slv(i+1, sum+a[i]);

}



signed main()

{



  cin >> N >> P;

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

    cin >> a[i];

  }



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



  cout << slv(0,0) << endl;



  return 0;

}




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

using i64 = std::int64_t;

using namespace std;



// Make Combination table using "Pascal's Triangle" at Compile-Time

template <size_t N>

struct CombTable {  // {{{

  static_assert(N < 70u,

                "Template parameter <N> is too large. It may be Overflow.");

  i64 mat[N + 1][N + 1];

  constexpr explicit CombTable() {

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

      for (int r = 0; r <= n; ++r) {

        mat[n][r] =

            ((r == 0 || n == r) ? (1) : (mat[n - 1][r - 1] + mat[n - 1][r]));

      }

    }

  }

  i64 operator()(int n, int r) const {

    return (r < 0 || n < r) ? 0 : mat[n][r];

  }

};  // }}}



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  cout.setf(ios_base::fixed);

  cout.precision(11);



  CombTable<55> comb;



  int N, P;

  cin >> N >> P;



  i64 cnt[2]{};

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

    int x;

    cin >> x;

    cnt[x & 1] += 1;

  }



  i64 ans = 0;



  for (int evenNum = 0; evenNum <= cnt[0]; ++evenNum) {

    for (int oddNum = 0; oddNum <= cnt[1]; ++oddNum) {

      if (oddNum % 2 == P) ans += comb(cnt[0], evenNum) * comb(cnt[1], oddNum);

    }

  }



  cout << ans << endl;



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
/*------------------------------------

........Bismillahir Rahmanir Rahim....

..........created by Abdul Aziz.......

------------------------------------*/

#include <iostream>

#include <algorithm>

#include <stdio.h>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <cstring>

#include <unordered_map>

#include <queue>

#define   mod  998244353

#define   int  long long 

#define   ld   long double

#define   pb   push_back

#define   vi  vector<int> 

#define   dbg(x)  cerr << #x << " = " << x << '\n'

#define   sz(x)  (int)x.size()

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

#define   ff   first

#define   ss   second

#define   pii  pair<int,int> 

#define   lcm(a,b) (a*b)/__gcd(a,b) 

using namespace std;



int  n,k; 

int a[52];

int dp[5005][52];



int fun(int idx,int sum){

    if (idx>n ) return (sum%2==k); 

    if (dp[sum][idx] != -1) return dp[sum][idx];

    return  dp[sum][idx] = fun(idx+1,sum)+fun(idx+1,sum+a[idx]);

}





inline void solve(){

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

    cin>>n>>k;

    for (int i=1;i<=n;i++) cin>>a[i];

    cout << fun(1,0) << endl;

}



signed main()

{

    int n=1; // cin>>n;

    while (n--) solve();

    return 0;

}


// Optimized solution to the same problem (faster):
/*------------------------------------

........Bismillahir Rahmanir Rahim....

..........created by Abdul Aziz.......

------------------------------------*/

#include <iostream>

#include <algorithm>

#include <stdio.h>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <cstring>

#include <unordered_map>

#include <queue>

#define   mod  998244353

#define   int  long long 

#define   ld   long double

#define   pb   push_back

#define   vi  vector<int> 

#define   dbg(x)  cerr << #x << " = " << x << '\n'

#define   sz(x)  (int)x.size()

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

#define   ff   first

#define   ss   second

#define   pii  pair<int,int> 

#define   lcm(a,b) (a*b)/__gcd(a,b) 

using namespace std;



int  n,k; 

int a[52];

int dp[2][52];



int fun(int idx,int sum){

    if (idx>n ) return (sum%2==k); 

    if (dp[sum][idx] != -1) return dp[sum][idx];

    return  dp[sum][idx] = fun(idx+1,sum%2) + fun(idx+1,(sum+a[idx])%2) ; 

}





inline void solve(){

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

    cin>>n>>k;

    for (int i=1;i<=n;i++) cin>>a[i];

    cout << fun(1,0) << endl;

}



signed main()

{

    int n=1; // cin>>n;

    while (n--) solve();

    return 0;

}


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

#include<iostream>

using namespace std;

int mi[200010];

int n,m,a,b;

const int mod=1000000007;

int ans=0;

int fast_pow(int a,int x)

{

	int ans=1;

	for (int i=x;i;i>>=1,a=1ll*a*a%mod)

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

	return ans;

}

int C(int n,int m)

{

	return ((1ll*mi[m]*fast_pow(mi[n],mod-2))%mod*1ll*fast_pow(mi[m-n],mod-2))%mod;

}

int main()

{

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

	mi[0]=1;

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

	{

		mi[i]=1ll*mi[i-1]*i%mod;

	}

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

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

	{

		int t=1ll*C(i-1,b+i-2)*C(n-i+1-1,m-b+1+n-i+1-3)%mod;

	//	cout<<i-1<<" "<<b+i-2<<" "<<n-i<<" "<<m+n-b-i<<" "<<t<<endl;

		ans=(1ll*ans+mod-t)%mod;

	}

	printf("%d",ans);

} 

// Optimized solution to the same problem (faster):
#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");

}










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

#include <cstdio>

using namespace std;

const int mo=1e9+7;

int fac[200001],x[100001],y[100001];

int pow(int x,int n){

	int t=1,y=x;

	while (n){

		if (n&1) t=1ll*t*y%mo;

		y=1ll*y*y%mo;

		n>>=1;

	}

	return t;

}

int main(){

	int h,w,a,b,i,j,m,ans=0;

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

	m=h+w;

	fac[0]=1;

	for (i=1;i<=m;++i) fac[i]=1ll*fac[i-1]*i%mo;

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

		x[i]=1ll*fac[h-a+i-2]*pow(1ll*fac[i-1]*fac[h-a-1]%mo,mo-2)%mo;

		y[i]=1ll*fac[a+w-i-1]*pow(1ll*fac[a-1]*fac[w-i]%mo,mo-2)%mo;

		ans=(ans+1ll*x[i]*y[i]%mo)%mo;

	}

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

	return 0;

}

// Optimized solution to the same problem (faster):
#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");

}










// Fastest known solution for this problem:
// Original C++ solution (slower):
#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);

}


// Optimized solution to the same problem (faster):
#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");

}










// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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");

}










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

using namespace std;



long long p = 1000000007;

long long mod_fact[200000];



void mod_fact_init(){

    mod_fact[0]=mod_fact[1]=1;

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

        mod_fact[i]=(mod_fact[i-1]*i)%p;

    }

}





long long mod_pow(long long a,long long b){

    a%=p;

    if(b==0){

        return 1;

    }else if(b%2==0){

        return mod_pow(a*a,b/2)%p;

    }else{

        return (a*mod_pow(a,b-1))%p;

    }

}



long long mod_comb(long long a,long long b){

    long long c = (mod_fact[a]*mod_pow(mod_fact[a-b],p-2))%p;

    return (c*mod_pow(mod_fact[b],p-2))%p;

}



int main(void){

    long long h,w,a,b,c=0;

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

    

    mod_fact_init();

    

    a=h-a-1;

    for(int i=0;a-i>=0&&b+i<=w-1;i++){

        c = (c+(mod_comb(a+b,a-i)%p)*(mod_comb(h-a+w-b-2,h-a-1+i)%p))%p;

    }

    cout<<c<<endl;

}


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

#include <vector>

using namespace std;

long long const mod = 1000000007;

long long mod_fact(int x){

    static vector<long long> fact = {1, 1};

    if(x < 0)return 0; //

    if(x < fact.size())return fact[x];

    for(int i = fact.size(); i <= x; i++){

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

    }

    return fact[x];

}



long long mod_pow(long long a, long long b){

    long long res = 1;

    a %= mod;

    while(b > 0){

        if(b%2 == 0){

            a = (a * a) % mod;

            b /= 2;

        }else{

            res = (res * a) % mod;

            b--;

        }

    }

    return res;

}



long long mod_comb(long long a, long long b){

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

    long long c = (mod_fact(a) * mod_pow(mod_fact(a-b), mod-2)) % mod;

    return (c * mod_pow(mod_fact(b), mod-2)) % mod;

}



int main(void){

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

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

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

        int y = h-a-i;

        int x = b+1+i;

        //cout << y << " " << x << endl;

        if(y < 1 || x > w)break;

        ans += (mod_comb(y+x-2, x-1) * mod_comb(h-y+w-x, h-y))%mod;

        ans %= mod;

        //cout << ans << endl;

    }

    cout << ans << endl;

}


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

using namespace std;

typedef long long ll;

ll f[200001], M=1e9+7;

ll p(ll a, ll b){

    if(b==0)return 1;

    if(b%2==0)return p((a*a)%M, b/2);

    return (a*p(a, b-1))%M;

}

ll c(int a, int b){

    return ((f[a]*p(f[b], M-2))%M * p(f[a-b], M-2))%M;

}

int main() {

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

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

    f[0] = 1;

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

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

    }

    for(int i=h-a;i>0;i--){

        int x=b+1+h-a-i;

        

        if(x>w)break;

        ans += (c(i+x-2, i-1) * c(h-i+w-x, h-i))%M;

        ans %= M;

    }

    cout << ans << endl;

	return 0;

}

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

#include <vector>

using namespace std;

long long const mod = 1000000007;

long long mod_fact(int x){

    static vector<long long> fact = {1, 1};

    if(x < 0)return 0; //

    if(x < fact.size())return fact[x];

    for(int i = fact.size(); i <= x; i++){

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

    }

    return fact[x];

}



long long mod_pow(long long a, long long b){

    long long res = 1;

    a %= mod;

    while(b > 0){

        if(b%2 == 0){

            a = (a * a) % mod;

            b /= 2;

        }else{

            res = (res * a) % mod;

            b--;

        }

    }

    return res;

}



long long mod_comb(long long a, long long b){

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

    long long c = (mod_fact(a) * mod_pow(mod_fact(a-b), mod-2)) % mod;

    return (c * mod_pow(mod_fact(b), mod-2)) % mod;

}



int main(void){

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

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

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

        int y = h-a-i;

        int x = b+1+i;

        //cout << y << " " << x << endl;

        if(y < 1 || x > w)break;

        ans += (mod_comb(y+x-2, x-1) * mod_comb(h-y+w-x, h-y))%mod;

        ans %= mod;

        //cout << ans << endl;

    }

    cout << ans << endl;

}


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

#include <cstdio>

#include <algorithm>

#include <cstring>

using namespace std;

typedef long long LL;

LL mod = 1e9 + 7;

LL f[200005];

LL qpow(LL x, LL n)

{

    LL res = 1, p = x;

    while(n)

    {

        if(n & 1)

            res = res*p%mod;

        p = p*p%mod;

        n >>= 1;

    }

    return res;

}



LL C(LL x, LL y)

{

    LL a = f[x], b = f[y]*f[x-y]%mod;

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

}

int main()

{

    f[0] = 1;

    for(int i = 1; i < 2e5+5; i++)

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

    LL h, w, a, b;

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

    {

        LL ans = 0;

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

        {

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

        }

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

    }

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<cctype>

#include<algorithm>

#define int long long

using namespace std;

inline int read(){

	int x=0,w=0;char c=getchar();

	while(!isdigit(c))w|=c=='-',c=getchar();

	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();

	return w?-x:x;

}

namespace star{

	const int maxn=1e5,mod=1e9+7;

	int h,w,a,b;

	inline int fpow(int a,int b){

		int ans=1;

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

		return ans;

	}

	int mul[maxn*2+10],inv[maxn*2+10];

	inline void pre(int n){

		mul[0]=inv[0]=1;

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

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

		inv[n]=fpow(mul[n],mod-2);

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

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

	}	

	inline int C(int n,int m){

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

	}

	inline void work(){

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

		pre(h+w);

		int ans=0;

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

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

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

	}

}

signed main(){

	star::work();

	return 0;

}

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



using namespace std;



const int maxn=200000+5;

const int mod=1000000007;



int h,w,a,b;

int fac[maxn];



void exgcd(int a,int b,int &g,int &x,int &y)

{

	if(b==0)g=a,x=1,y=0;

	else exgcd(b,a%b,g,y,x),y-=a/b*x;

}



int inv(int a)

{

	int g,x,y;

	exgcd(a,mod,g,x,y);

	return(x+mod)%mod;

}



int C(int n,int m)

{

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

}



int f(int n,int m)

{

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

}



int main()

{

	fac[0]=1;

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

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

	int ret=0;

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

	{

		ret=(ret+(long long)f(i,b)*f(h-i+1,w-b))%mod;

	}

	cout<<ret<<endl;

}

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

#include<cstdio>

#include<cstring>

#include<cctype>

#include<algorithm>

#define int long long

using namespace std;

inline int read(){

	int x=0,w=0;char c=getchar();

	while(!isdigit(c))w|=c=='-',c=getchar();

	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();

	return w?-x:x;

}

namespace star{

	const int maxn=1e5,mod=1e9+7;

	int h,w,a,b;

	inline int fpow(int a,int b){

		int ans=1;

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

		return ans;

	}

	int mul[maxn*2+10],inv[maxn*2+10];

	inline void pre(int n){

		mul[0]=inv[0]=1;

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

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

		inv[n]=fpow(mul[n],mod-2);

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

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

	}	

	inline int C(int n,int m){

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

	}

	inline void work(){

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

		pre(h+w);

		int ans=0;

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

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

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

	}

}

signed main(){

	star::work();

	return 0;

}

// Fastest known solution for this problem: