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

using namespace std;



long dp[55][2525][55];



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    int n, a; cin >> n >> a;

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



    dp[0][0][0] = 1;



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

        for(int j=0; j <= 2500; ++j) {

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

                dp[i+1][j][k] += dp[i][j][k];

                if(k > 0 && j >= x[i]) dp[i+1][j][k] += dp[i][j-x[i]][k-1];

            }

        }

    }



    long ans = 0;

    for(int k=1; k <= n; ++k) {

        for(int j=0; j <= 2500; ++j) {

            if(j % k == 0 && j / k == a) ans += dp[n][j][k];

        }

    }



    cout << ans << endl;

    return 0;

}

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

using namespace std;



long dp[5500];



int main() {

    ios::sync_with_stdio(false); cin.tie(0);

    int n, a; cin >> n >> a;

    int x[50]; for(int i=0; i < n; ++i) cin >> x[i], x[i] -= a;



    dp[2500] = 1;

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

        if(x[i] >= 0) {

            for(int j=5000; j >= x[i]; --j) {

                dp[j] += dp[j - x[i]];

            }

        } else {

            for(int j=0; j <= 5000; ++j) {

                dp[j] += dp[j - x[i]];

            }

        }

    }



    cout << dp[2500] - 1 << '\n';

    return 0;

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

#include <map>

#include <bitset>

#include <iomanip>

#include <string>

#include <algorithm>

#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)

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

#define PB push_back

#define INF 1100000000

#define LLINF 1100000000000000000

#define MOD 1000000007

#define FI first

#define SE second

#define MP make_pair



using namespace std;

typedef long long ll;



ll dp[60][60][2600];

int main()

{

  int N, A;

  cin >> N >> A;

  vector<int> x(N); REP(i, N) cin >> x[i];

  dp[0][0][0] = 1;

  REP(i, N) {

    REP(j, N) {

      REP(k, 2501) {

        dp[i + 1][j][k] += dp[i][j][k];

        dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];

      }

    }

  }



  ll ans = 0;

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

    ans += dp[N][i][A*i];

  }

  cout << ans << endl;

  return 0;

}

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

#include <map>

#include <bitset>

#include <iomanip>

#include <string>

#include <algorithm>

#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)

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

#define PB push_back

#define INF 1100000000

#define LLINF 1100000000000000000

#define MOD 1000000007

#define FI first

#define SE second

#define MP make_pair



using namespace std;

typedef long long ll;



ll dp[60][5200];

constexpr int OFFSET = 2600;



int main()

{

  int N, A;

  cin >> N >> A;

  vector<int> x(N);

  REP(i, N) {

    cin >> x[i];

    x[i] -= A;

  }



  dp[0][OFFSET] = 1;

  REP(i, N) {

    REP(j, 5200) {

      dp[i + 1][j] += dp[i][j];

      if (0 <= j + x[i] && j + x[i] < 5200)

        dp[i + 1][j + x[i]] += dp[i][j];

    }

  }



  cout << dp[N][OFFSET] - 1 << endl;

  return 0;

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


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

#define N 300010

#define MOD 998244353

using namespace std;

typedef long long ll;

ll n,a,b,c;

ll P,Q[N];

ll extgcd(ll a,ll b,ll &x,ll &y) {

	if(b) {

		ll k=extgcd(b,a%b,x,y);

		ll t=x;x=y;

		y=t-a/b*y;

		return k;

	} else {

		x=1;y=0;

		return a;

	}

}

inline ll C(int x) {

	return P*Q[x]%MOD*Q[n-x]%MOD;

}

inline ll solve() {

	ll x,y,d,k,m;

	d=extgcd(a,b,x,y);

	if(c%d) return 0;

	k=c/d;x*=k;y*=k;

	if(y<0) {

		k=x;x=y;y=k;

		k=a;a=b;b=k;

	}

	k=b/d;

	m=(x-k+1)/k;

	x-=m*b/d,y+=m*a/d;

	P=Q[1]=1;

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

		P=P*i%MOD;

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

	}

	Q[0]=1;for(int i=2;i<=n;++i) Q[i]=Q[i]*Q[i-1]%MOD;

	ll ans=0;

	for(;x<=n&&y>=0;x+=b/d,y-=a/d) {

		if(y<=n) {

			ans+=C(x)*C(y);

			ans%=MOD;

		}

	}

	return ans;

}

int main() {

	cin>>n>>a>>b>>c;

	cout<<solve()<<endl;

	return 0;

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


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



using namespace std;



#define int long long

const int N = 3e5+1 ,mod = 998244353;



int n,a,b,k,ans;

int Pow[N];

int cal( int a,int b){

	if(b == 1) return a;

	int res = cal(a,b/2);

	res = (res*res) % mod;

	if( b % 2 ) res = (res * a) % mod;

	return res;	

}

int Ckn(int k,int n){

	if(k > n) return 0LL;

	int res = Pow[n];

	res = (res * cal( (Pow[k]*Pow[n-k])%mod, mod-2)) % mod;

	return res;

}

signed main(){

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	cin >> n >> a >> b >> k;

	Pow[0] = 1;

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

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

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

		int x = i;

		int y = k - a * i;

		if(y < 0 | y % b) continue;

		y /= b;

		ans = (ans + (Ckn(x,n)*Ckn(y,n)) % mod) % mod;

	}

	cout << ans;

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


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



using namespace std;



long long n,a,b,k,pref[300005],suff[300005],ans = 0;

const long long mod = 998244353;



long long BinPow(long long x,long long n){

    if(n==0)

        return 1;

    else if(n==1)

        return x;

    else{

        long long sum = BinPow(x,n/2);

        sum*=sum; sum%=mod;

        if(n%2!=0)

            sum*=x;

        sum%=mod;

        return sum;

    }

}



long long C(long long s,long long k){

    return (((pref[s]*suff[k])%mod)*suff[s-k])%mod;

}



int main(){

    cin.tie(0),ios::sync_with_stdio(0);

    cin>>n>>a>>b>>k;

    pref[0] = 1,suff[0] = 1;

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

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

        pref[i]%=mod;

    }

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

        suff[i] = BinPow(pref[i],mod-2);

        suff[i]%=mod;

    }

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

        if((k-a*i)%b==0&&(k-a*i)>=0){

            long long times = (k-a*i)/b;

            if(times<=n){

                ans+=(C(n,times)*C(n,i))%mod;

                ans%=mod;

            }

        }

    }

    cout<<ans;

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


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

using namespace std;



long long mod=998244353;

long long fact[300010];

long long res[300010];

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

{

	if(n==0) return 1;

	else if(n==1) return x;

	else

	{

		long long sum=poww(x,n/2);

		sum=sum*sum;

		sum=sum%mod;

		if(n%2!=0)

		sum=sum*x;

		sum=sum%mod;

		return sum;

	}

}

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

{

	return (((fact[n]*res[k]) % mod) * res[n-k]) % mod;

}

int main()

{

	ios_base::sync_with_stdio(0);

	cin.tie(0);

	cout.tie(0);

	long long n,a,b,k;

	cin >> n >> a >> b >> k;

	fact[0]=1,res[0]=1;

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

	{

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

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

		res[i]=poww(fact[i],mod-2);

		res[i]=res[i]%mod;

	}

	long long ans=0;

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

	{

		if((k-a*i)%b==0 && (k-a*i)>=0)

		{

			long long t=(k-a*i)/b;

			if(t<=n)

			{

			ans+=(C(t,n) * C(i,n))%mod;

			ans=ans%mod;

		    }

		}

	}

	cout << ans << "\n";

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


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

using namespace std;



const int maxn = 3e5 + 5;

const int mod = 998244353;



long long n, a, b, k;

long long fac[maxn];

long long inv[maxn];



long long C(long long x){

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

}



int main(){

    cin >> n >> a >> b >> k;

    if (k == 0){

        cout << 1 << endl;

        return 0;

    }

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

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

		inv[i] = 1ll * inv[mod % i] * (mod - mod / i) % mod;

	}

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

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

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

	}

	long long ans = 0;

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

        long long rest = k - red * a;

        long long blue = rest / b;

        if (rest % b == 0 && blue <= n && rest >= 0){

            ans = (ans + C(red) * C((long long)rest / b)) % mod;

        }

    }

    cout << ans << endl;

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


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

using namespace std;



const int N = 3e5 + 10;

const int mod = 998244353;



int c[N];



int extgcd(int a, int b, int& x, int& y){

	int d = a;

	if (b != 0){

		d = extgcd(b, a % b, y, x);

		y -= (a / b) * x;

	}

	else{

		x = 1;

		y = 0;

	}

	return d;

}



int mod_inverse(int a){

	int x, y, m;

	m = mod;

	extgcd(a, m, x, y);

	return (m + x % m) % m;

}



int main(){

	int n, a, b, res, ans;

	long long k;

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

	c[0] = 1;

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

		c[i] = 1LL * c[i - 1] * (n - i + 1) % mod * mod_inverse(i) % mod;

	ans = 0;

	for (int i = 0; i <= min(k / a, 1LL * n); i++){

		res = (k - 1LL * a * i) / b;

		if ((k - 1LL * a * i) % b || res > n) continue;

		ans += 1LL * c[i] * c[res] % mod;

		ans %= mod;

	}

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

	return 0;

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

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

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

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

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

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


// Faster C++ solution for the same problem (measured speedup: 1.450598745443058x):
///=======================///

/// coder: Andy - Tohrumi ///

///=======================///



#include<bits/stdc++.h>

#define ll long long

#define ld long double

#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);

#define mod 998244353

#define INF LLONG_MAX

#define pb push_back

#define mp make_pair

#define endl '\n'

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

#define Rep(i, n, s) for(int i = n; i > s; i--)

#define repl(i, s, n) for(ll i = s; i < n; i++)

#define Repl(i, n, s) for(ll i = n; i > s; i--)

#define x first

#define y second

using namespace std;

typedef pair<ll, ll> pll;	typedef pair<int, int> ii;

typedef vector<pll> vll;	typedef vector<string> vs;		typedef vector<ii> vii;

typedef vector<int> vi; 	typedef vector<ll> vl;



ll factorial[300005];



void cal() {

	factorial[0] = 1;

	rep(i, 1, 300005) {

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

	}

}



ll binpow(ll a, ll b) {

	if(b == 0) return 1;

	ll x = binpow(a, b >> 1);

	x *= x; x %= mod;

	if(b % 2) return (x * a) % mod;

	else return x;

}



ll bindiv(ll a, ll b) {

	ll inv = binpow(b, mod - 2);

	return (a * inv) % mod;

}



ll C(ll k, ll n) {

	ll x = (factorial[k] * factorial[n - k]) % mod;

	return bindiv(factorial[n], x);

}



signed main() {

	fastio;

	cal();

	ll n, a, b, k; cin >> n >> a >> b >> k;

	vll ans;

	rep(i, 0, n + 1) {

		ll c = k - a * i;

		c /= b;

		if(c <= n && c >= 0 && a * i + b * c == k) {

			ans.pb(mp(i, c));

		}

	}

	ll res = 0;

	rep(i, 0, ans.size()) {

		res = (res + C(ans[i].x, n) * C(ans[i].y, n)) % mod;

	}

	cout << res << endl;

	return 0;

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

#define ll long long

#define clz 998244353

ll a,b,k;

ll fac[300010];

ll ca[300010],cb[300010];

int n,p;

ll inv(ll x){ 

    if(x==1) return 1;  

    return (clz-clz/x)*inv(clz%x)%clz;  

}

ll C(ll n,ll m){

	ll x=(fac[m]*fac[n-m])%clz;

	return (fac[n]*inv(x))%clz;

}

int main(){

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

	for(int i=2;i<=300001;i++) fac[i]=(fac[i-1]*i)%clz;

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

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

		if(k-i*a>=0&&(k-i*a)%b==0&&(k-i*a)/b<=n){

			ca[++p]=i;

			cb[p]=(k-i*a)/b; 

		}

	}

	ll ans=0;

	for(int i=1;i<=p;i++) ans=(ans+C(n,ca[i])*C(n,cb[i])%clz)%clz;

	printf("%lld",ans);

	return 0;

} 

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

#define Mod 998244353

int gcd(int x,int y){return y?gcd(y,x%y):x;}

int n,a,b;

long long sum,k,t,inv[300100],C[300100];

int main(){

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

	inv[1]=1;for(int i=2;i<=n;++i)inv[i]=(Mod-Mod/i)*inv[Mod%i]%Mod;

	C[0]=1;for(int i=1;i<=n;++i)C[i]=C[i-1]*(n-i+1)%Mod*inv[i]%Mod;

	t=gcd(a,b);a/=t;b/=t;

	if(k%t!=0){puts("0");return 0;}else k/=t;

	for(long long i=0;i<=b;++i)if((k-a*i)%b==0){t=i;break;}

	for(long long i=t;i*a<=k&&i<=n;i+=b){

		if((k-i*a)/b<=n)sum=(sum+C[i]*C[(k-i*a)/b])%Mod;

	}

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

	return 0;

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

#include<cstdio>

#define mod 998244353

using namespace std;

long long n,a,b,k,ans=0,anss[300005][3],fac[300005],cnt=0;

inline long long inv(long long b){  

    return b==1?1:(mod-mod/b)*inv(mod%b)%mod;

}

inline long long C(long long n,long long m){  

    long long t=(fac[m]*fac[n-m])%mod;

    return (fac[n]*inv(t))%mod;

}

inline void init(){

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

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

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

}

int main(){

	init();

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

		if(k>=(i*a)&&(k-a*i)%b==0&&(k-a*i)/b<=n){

			anss[cnt][0]=i;

			anss[cnt++][1]=(k-a*i)/b;

		}

	for(int i=0;i<cnt;i++) ans=(ans+C(n,anss[i][0])*C(n,anss[i][1])%mod)%mod;

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

	return 0;

}

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

#define Mod 998244353

int gcd(int x,int y){return y?gcd(y,x%y):x;}

int n,a,b;

long long sum,k,t,inv[300100],C[300100];

int main(){

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

	inv[1]=1;for(int i=2;i<=n;++i)inv[i]=(Mod-Mod/i)*inv[Mod%i]%Mod;

	C[0]=1;for(int i=1;i<=n;++i)C[i]=C[i-1]*(n-i+1)%Mod*inv[i]%Mod;

	t=gcd(a,b);a/=t;b/=t;

	if(k%t!=0){puts("0");return 0;}else k/=t;

	for(long long i=0;i<=b;++i)if((k-a*i)%b==0){t=i;break;}

	for(long long i=t;i*a<=k&&i<=n;i+=b){

		if((k-i*a)/b<=n)sum=(sum+C[i]*C[(k-i*a)/b])%Mod;

	}

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

	return 0;

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

#define ll long long

#define clz 998244353

ll a,b,k;

ll fac[300010];

ll ca[300010],cb[300010];

int n,p;

ll inv(ll x){ 

    if(x==1) return 1;  

    return (clz-clz/x)*inv(clz%x)%clz;  

}

ll C(ll n,ll m){

	ll x=(fac[m]*fac[n-m])%clz;

	return (fac[n]*inv(x))%clz;

}

int main(){

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

	for(int i=2;i<=300001;i++) fac[i]=(fac[i-1]*i)%clz;

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

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

		if(k-i*a>=0&&(k-i*a)%b==0&&(k-i*a)/b<=n){

			ca[++p]=i;

			cb[p]=(k-i*a)/b; 

		}

	}

	ll ans=0;

	for(int i=1;i<=p;i++) ans=(ans+C(n,ca[i])*C(n,cb[i])%clz)%clz;

	printf("%lld",ans);

	return 0;

} 

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

#define mod 998244353

#define ll long long

using namespace std;

int n,a,b,q[300005],x[300005],ans;

ll k;

int pow(int c,int p){

	int tot=1;

	while(p){

		if(p&1) tot=1ll*c*tot%mod;

		c=1ll*c*c%mod;

		p>>=1;

	}

	return tot;

}

int C(int A,int B){

	if(A==0) return 1; if(A>B) return 0; if(A==B) return 1;

	return 1ll*q[B]*x[A]%mod*x[B-A]%mod;

}

int main(){

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

	q[1]=1;for(int i=2;i<=n;++i) q[i]=1ll*q[i-1]*i%mod;

	x[n]=pow(q[n],mod-2);

	for(int i=n-1;i>=0;--i) x[i]=x[i+1]*1ll*(i+1)%mod;

	if(k==0){puts("1");return 0;}

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

		ll j=k-1ll*i*a;

		if(j<0||j%b) continue;

		j/=b;

		ans=(ans+1ll*C(i,n)*C(j,n)%mod)%mod;

	}

	printf("%d",ans);

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

#include<cstdio>

#define mod 998244353

using namespace std;

long long n,a,b,k,ans=0,anss[300005][3],fac[300005],cnt=0;

inline long long inv(long long b){  

    return b==1?1:(mod-mod/b)*inv(mod%b)%mod;

}

inline long long C(long long n,long long m){  

    long long t=(fac[m]*fac[n-m])%mod;

    return (fac[n]*inv(t))%mod;

}

inline void init(){

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

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

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

}

int main(){

	init();

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

		if(k>=(i*a)&&(k-a*i)%b==0&&(k-a*i)/b<=n){

			anss[cnt][0]=i;

			anss[cnt++][1]=(k-a*i)/b;

		}

	for(int i=0;i<cnt;i++) ans=(ans+C(n,anss[i][0])*C(n,anss[i][1])%mod)%mod;

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

	return 0;

}

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

#define mod 998244353

#define ll long long

using namespace std;

int n,a,b,q[300005],x[300005],ans;

ll k;

int pow(int c,int p){

	int tot=1;

	while(p){

		if(p&1) tot=1ll*c*tot%mod;

		c=1ll*c*c%mod;

		p>>=1;

	}

	return tot;

}

int C(int A,int B){

	if(A==0) return 1; if(A>B) return 0; if(A==B) return 1;

	return 1ll*q[B]*x[A]%mod*x[B-A]%mod;

}

int main(){

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

	q[1]=1;for(int i=2;i<=n;++i) q[i]=1ll*q[i-1]*i%mod;

	x[n]=pow(q[n],mod-2);

	for(int i=n-1;i>=0;--i) x[i]=x[i+1]*1ll*(i+1)%mod;

	if(k==0){puts("1");return 0;}

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

		ll j=k-1ll*i*a;

		if(j<0||j%b) continue;

		j/=b;

		ans=(ans+1ll*C(i,n)*C(j,n)%mod)%mod;

	}

	printf("%d",ans);

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

#define ll long long

#define clz 998244353

ll a,b,k;

ll fac[300010];

ll ca[300010],cb[300010];

int n,p;

ll inv(ll x){ 

    if(x==1) return 1;  

    return (clz-clz/x)*inv(clz%x)%clz;  

}

ll C(ll n,ll m){

	ll x=(fac[m]*fac[n-m])%clz;

	return (fac[n]*inv(x))%clz;

}

int main(){

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

	for(int i=2;i<=300001;i++) fac[i]=(fac[i-1]*i)%clz;

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

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

		if(k-i*a>=0&&(k-i*a)%b==0&&(k-i*a)/b<=n){

			ca[++p]=i;

			cb[p]=(k-i*a)/b; 

		}

	}

	ll ans=0;

	for(int i=1;i<=p;i++) ans=(ans+C(n,ca[i])*C(n,cb[i])%clz)%clz;

	printf("%lld",ans);

	return 0;

} 

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

#define mod 998244353

#define ll long long

using namespace std;

int n,a,b,q[300005],x[300005],ans;

ll k;

int pow(int c,int p){

	int tot=1;

	while(p){

		if(p&1) tot=1ll*c*tot%mod;

		c=1ll*c*c%mod;

		p>>=1;

	}

	return tot;

}

int C(int A,int B){

	if(A==0) return 1; if(A>B||B-A>n) return 0; if(A==B) return 1;

	return 1ll*q[B]*x[A]%mod*x[B-A]%mod;

}

int main(){

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

	q[1]=1;for(int i=2;i<=n;++i) q[i]=1ll*q[i-1]*i%mod;

	x[n]=pow(q[n],mod-2);

	for(int i=n-1;i>=0;--i) x[i]=x[i+1]*1ll*(i+1)%mod;

	if(k==0){puts("1");return 0;}

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

		ll j=k-1ll*i*a;

		if(j%b) continue;

		j/=b;

		ans=(ans+1ll*C(i,n)*C(j,n)%mod)%mod;

	}

	printf("%d",ans);

}