stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

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

}

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

#define int long long

using namespace std;

const int N = 3e5+10;

const int mod = 998244353;



int n,a,b,k;

int g[N],rev[N];



long long binpow(int a,int x)

{

 

	long long res;

	if(x == 0) return 1;

	res = binpow(a,x/2) % mod;

	if(x % 2 == 0) return res*res % mod;

	else return ((a*res) % mod * res) % mod;

}



void add(long long &x, long long y) { x = (x + y) % mod; }



long long tohop(int k,int n)

{

	if(k < 0 || n < 0 || k > n) return 0;

	int val = g[n-k]*g[k] % mod;

	return (g[n] * binpow(val,mod-2)) % mod;

}



signed main()

{

	int ans = 0;

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

	g[0] = 1;

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

	{

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

	}



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

	{

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

		{

			int j = (k-a*i)/b;

			int val = tohop(i,n) * tohop(j,n) % mod;

				add(ans, val);

		}

	}



	cout<<ans;

}

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

#define sl(x) scanf("%lld",&x)

#define pl(x) printf("%lld\n",x) 

using namespace std;

const int N = 1e6+5;

const int mod = 998244353;

const int INF = 0x3f3f3f3f;

typedef long long ll;

ll inv(ll b)

{

	if(b == 1)

	return 1;

	return (mod-mod/b)*inv(mod%b)%mod;

}

ll fac[N];

ll C(ll n,ll m)

{

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

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

}

ll ans[N][2];

int main()

{

	ll n,i,a,b,k;

	fac[0] = 1;

	fac[1] = 1;

	for(i = 2;i <= 3e5+5;i++)

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

	sl(n);sl(a);sl(b);sl(k);

	ll cnt = 0;

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

	{

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

		{

			ans[cnt][0] = i;

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

		}

	}

	ll res=0;

	for(i = 0;i < cnt;i++)

	{

		res = (res+C(n,ans[i][0])*C(n,ans[i][1])%mod)%mod;

	}

	pl(res);

}

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

#define rep(i,l,r) for (ll i=l;i<=r;i++)

#define per(i,l,r) for (ll i=l;i>=r;i--)

using namespace std;

typedef long long ll;

const ll mm=998244353;

const int N=300000;

ll fac[N+10],inv[N+10],ans,a,b,k,n;

ll Pow(ll x,ll y){

	ll ans=1;

	while (y){

		if (y&1) ans=ans*x%mm;

		x=x*x%mm;

		y/=2;

	}

	return ans;

}

ll C(ll n,ll m){

	if (n<m) return 0;

	return fac[n]*inv[m]%mm*inv[n-m]%mm;

}

int main(){

	fac[0]=1;

	rep(i,1,N) fac[i]=fac[i-1]*i%mm;

	inv[N]=Pow(fac[N],mm-2);

	per(i,N,1) inv[i-1]=inv[i]*i%mm;

	scanf("%lld",&n);

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

	rep(y,0,n){

		ll res=b*y;

		if (k-res>=0&&(k-res)%a==0) {

			ll x=(k-res)/a;

			(ans+=C(n,x)*C(n,y)%mm)%=mm;

		}

	}

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

	return 0;

}

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

#define sl(x) scanf("%lld",&x)

#define pl(x) printf("%lld\n",x) 

using namespace std;

const int N = 1e6+5;

const int mod = 998244353;

const int INF = 0x3f3f3f3f;

typedef long long ll;

ll inv(ll b)

{

	if(b == 1)

	return 1;

	return (mod-mod/b)*inv(mod%b)%mod;

}

ll fac[N];

ll C(ll n,ll m)

{

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

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

}

ll ans[N][2];

int main()

{

	ll n,i,a,b,k;

	fac[0] = 1;

	fac[1] = 1;

	for(i = 2;i <= 3e5+5;i++)

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

	sl(n);sl(a);sl(b);sl(k);

	ll cnt = 0;

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

	{

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

		{

			ans[cnt][0] = i;

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

		}

	}

	ll res=0;

	for(i = 0;i < cnt;i++)

	{

		res = (res+C(n,ans[i][0])*C(n,ans[i][1])%mod)%mod;

	}

	pl(res);

}

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

#define MOD 998244353

#define int long long

#define pb push_back

#define bw(i,r,l) for (int i=r-1;i>=l;i--)

#define fw(i,l,r) for (int i=l;i<r;i++)

using namespace std;

int n,a,b,k,fac[300001];

int getpow(int a,int p) {

	if (!p) return 1;

	int temp=getpow(a,p/2),ans=temp*temp; ans%=MOD;

	if (p&1) ans*=a; ans%=MOD;

	return ans;

}

int getC(int k,int n) {

	if (k>n||k<0) return 0;

	return fac[n]*getpow(fac[k]*fac[n-k]%MOD,MOD-2)%MOD;

}

signed main() {

	//freopen("aome.inp","r",stdin);

	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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

	fac[0]=1; fw (i,1,n+1) {fac[i]=fac[i-1]*i; fac[i]%=MOD;}

	int ans=0;

	fw (i,0,n+1) if (a*i<=k) {

		int temp=k-a*i; if (temp%b!=0) continue;

		int j=temp/b;

		ans+=getC(i,n)*getC(j,n); ans%=MOD;

	}

	cout<<ans;

}

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

const long long MOD = 998244353;

const int MAXN = 300010;

long long fac[MAXN], ifac[MAXN];

long long exGCD(long long a, long long b, long long& x, long long& y) {

	if (b == 0) {

		x = 1;

		y = 0;

		return a;

	}

	long long g = exGCD(b, a % b, x, y);

	long long temp = x;

	x = y;

	y = temp - a / b * y;

	return g;

}

int inverse(long long a) {

	long long x, y;

	exGCD(a, MOD, x, y);

	return (x % MOD + MOD) % MOD;

}

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

	return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;

}

int main() {

	long long n, a, b, k;

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

	fac[0] = 1;

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

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

	}

	ifac[n] = inverse(fac[n]);

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

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

	}

	long long ans = 0;

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

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

			ans = (ans + C(n, i) * C(n, (k - i * a) / b) % MOD) % MOD;

		}

	}

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

	return 0;

}

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

#define ll long long

using namespace std;

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

int fac[N];

int fp(int a, int p) {

	if (!p) return 1;

	int t = fp(a, p >> 1);

	t = (t * 1ll * t) % mod;

	if (p & 1) t = (t * 1ll * a) % mod;

	return t;

}

ll ncr(int n, int r) {

	return ((fac[n] * 1ll * fp(fac[r], mod - 2)) % mod * 1ll * fp(fac[n - r], mod - 2)) % mod;

}

int main() {

	ios_base::sync_with_stdio(0);

	cin.tie(0);

	fac[0] = 1;

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

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

	int n, a, b;

	ll k;

	int ans = 0;

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

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

		ll x = i * 1ll * a;

		if (x > k || (k - x) % b) continue;

		ll y = (k - x) / b;

		if (y > n) continue;

		ans = (ans + (ncr(n, i) * 1ll * ncr(n, y)) % mod) % mod;

	}

	cout << ans << endl;

	return 0;

}




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

const long long MOD = 998244353;

const int MAXN = 300010;

long long fac[MAXN], ifac[MAXN];

long long exGCD(long long a, long long b, long long& x, long long& y) {

	if (b == 0) {

		x = 1;

		y = 0;

		return a;

	}

	long long g = exGCD(b, a % b, x, y);

	long long temp = x;

	x = y;

	y = temp - a / b * y;

	return g;

}

int inverse(long long a) {

	long long x, y;

	exGCD(a, MOD, x, y);

	return (x % MOD + MOD) % MOD;

}

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

	return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;

}

int main() {

	long long n, a, b, k;

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

	fac[0] = 1;

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

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

	}

	ifac[n] = inverse(fac[n]);

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

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

	}

	long long ans = 0;

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

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

			ans = (ans + C(n, i) * C(n, (k - i * a) / b) % MOD) % MOD;

		}

	}

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

	return 0;

}

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

#define int long long

using namespace std;



const int N = 3e5 + 5;

const int MOD = 998244353;



int n, a, b, k;

int fac[N], ifac[N];



int fpow(int x,int y) {

	int res = 1;

	while (y) {

		if (y & 1) res = res * x % MOD;

		x = x * x % MOD;

		y >>= 1;

	}

	return res;

}



void prec() {

	fac[0] = 1;

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

	ifac[N - 1] = fpow(fac[N - 1], MOD - 2);

	for (int i = N - 2;i >= 0;--i) ifac[i] = ifac[i + 1] * (i + 1) % MOD;

}



int C(int k,int n) {

	if (n < k || k < 0) return 0;

	return fac[n] * ifac[k] % MOD * ifac[n - k] % MOD;

}



signed main() {

	ios_base::sync_with_stdio(false);

	prec();

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

	int res = 0;

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

		if ((k - x * a) % b) continue;

		int y = (k - x * a) / b;

		res = (res + C(x, n) * C(y, n)) % MOD;

	}

	cout << res << '\n'

;}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

#define N 300010

#define Mod 998244353

#define LL long long

LL s1[N],s2[N];

LL find(LL x,LL y)

{

    LL ans=1;

    x=x%Mod;

    while(y)

    {

        if(y%2)

            ans=ans*x%Mod;

        x=x*x%Mod;

        y=y/2;

    }

    return ans;

}

int main()

{

    LL n,m,x,y;

    LL i,j,k;

    LL ans;

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

    s1[0]=1;

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

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

    s2[n]=find(s1[n],Mod-2);

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

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

    ans=0;

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

    {

        if((m-i*x)%y!=0||(m-i*x<0)||(m-i*x)/y>n)

            continue;

        ans=(ans+s1[n]*s2[i]%Mod*s2[n-i]%Mod*s1[n]%Mod*s2[(m-i*x)/y]%Mod*s2[n-(m-i*x)/y]%Mod)%Mod;

    }

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

    return 0;

}

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

using namespace std;

const int maxn = 3e5 + 5;

const int MOD = 998244353;

#define LL long long

LL n,a,b,k;

LL fac[maxn];

LL inv[maxn];

LL C(LL 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;

	}

	LL ans = 0;

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

        LL rest = k - red * a;

        LL blue = rest / b;

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

            ans = (ans + C(red) * C((LL)rest / b)) % MOD;

        }

    }

    cout<<ans<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

#define N 300010

#define Mod 998244353

#define LL long long

LL s1[N],s2[N];

LL find(LL x,LL y)

{

    LL ans=1;

    x=x%Mod;

    while(y)

    {

        if(y%2)

            ans=ans*x%Mod;

        x=x*x%Mod;

        y=y/2;

    }

    return ans;

}

int main()

{

    LL n,m,x,y;

    LL i,j,k;

    LL ans;

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

    s1[0]=1;

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

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

    s2[n]=find(s1[n],Mod-2);

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

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

    ans=0;

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

    {

        if((m-i*x)%y!=0||(m-i*x<0)||(m-i*x)/y>n)

            continue;

        ans=(ans+s1[n]*s2[i]%Mod*s2[n-i]%Mod*s1[n]%Mod*s2[(m-i*x)/y]%Mod*s2[n-(m-i*x)/y]%Mod)%Mod;

    }

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

    return 0;

}

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

using namespace std;

const long long mod=998244353;

long long n,a,b,k,f[300001];

long long pow(long long a, long long b, long long MOD)

{

 long long x=1,y=a; 

 while(b > 0)

 	{

 		if(b%2 == 1)

 	{

 		x=(x*y);

 		if(x>MOD) x%=MOD;

 	}

 	y = (y*y);

 	if(y>MOD) y%=MOD; 

 	b /= 2;

 	}

 return x;

}

 

/* Modular Multiplicative Inverse

 Using Euler's Theorem

 a^(phi(m)) = 1 (mod m)

 a^(-1) = a^(m-2) (mod m) */

long long InverseEuler(long long n, long long MOD)

{

 return pow(n,MOD-2,MOD);

}

 

long long C(long long n, long long r, long long MOD)

{

 

 return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;

}

int main(){

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

	f[0]=1;

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

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

	}

	long long ans=0;

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

		if((k-(i*a))<0){

			break;

		}

		else{

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

				ans+=C(n,i,mod)*C(n,(k-i*a)/b,mod);

				ans%=mod;

			}

		}

	}

	cout<<ans;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

#define N 300010

#define Mod 998244353

#define LL long long

LL s1[N],s2[N];

LL find(LL x,LL y)

{

    LL ans=1;

    x=x%Mod;

    while(y)

    {

        if(y%2)

            ans=ans*x%Mod;

        x=x*x%Mod;

        y=y/2;

    }

    return ans;

}

int main()

{

    LL n,m,x,y;

    LL i,j,k;

    LL ans;

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

    s1[0]=1;

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

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

    s2[n]=find(s1[n],Mod-2);

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

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

    ans=0;

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

    {

        if((m-i*x)%y!=0||(m-i*x<0)||(m-i*x)/y>n)

            continue;

        ans=(ans+s1[n]*s2[i]%Mod*s2[n-i]%Mod*s1[n]%Mod*s2[(m-i*x)/y]%Mod*s2[n-(m-i*x)/y]%Mod)%Mod;

    }

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

    return 0;

}

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


#include<bits/stdc++.h>

using namespace std;

const int N = 1e6+5;

const int mod = 998244353;

const int INF = 0x3f3f3f3f;

long long  inv(long long b)

{

	if(b == 1)

	return 1;

	return (mod-mod/b)*inv(mod%b)%mod;

}

long long fac[N];

long long C(long long n,long long m)

{

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

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

}

int main()

{

	long long n,i,a,b,k;

	fac[0] = 1;

	fac[1] = 1;

	for(i = 2;i <= 3e5+5;i++)

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

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

	long long res = 0;

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

	{

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

		{

		    res = (res+C(n,i)*C(n,(k-a*i)/b)%mod)%mod;

		}

	}

	cout<<res<<endl;



}


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

#include<algorithm>

#include<cmath>

#include<iostream>

#include<cstring>

#define ll long long

using namespace std;

const int D=998244353,MAXN=300005;

ll n,a,b,k,x,y,ans;

ll ifac[MAXN],fac[MAXN];

ll power_(ll x,ll k)

{

	ll ret=1;

	while(k)

	{

		if(k&1) ret=(ret*x)%D;

		x=(x*x)%D;

		k>>=1;

	}

	return ret;

}

void first_()

{

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

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

	ifac[n]=power_(fac[n],D-2);

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

		ifac[i-1]=(ifac[i]*i)%D;

}

ll C(ll aa,ll bb)

{

	if(bb<aa) return 0;

	return (fac[bb]*ifac[aa]%D*ifac[bb-aa])%D;

}

int main()

{

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

	if(!k) {printf("1\n");return 0;}

	first_();

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

	{

		if(a*i>k) break;

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

		{

			x=i;

			y=(k-a*i)/b;

			ans=(ans+C(x,n)*C(y,n)+D)%D;

		}

	}

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

	return 0;

}

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


#include<bits/stdc++.h>



#define sl(x) scanf("%lld",&x)



#define pl(x) printf("%lld\n",x) 



using namespace std;



const int N = 1e6+5;



const int mod = 998244353;



const int INF = 0x3f3f3f3f;



typedef long long ll;



ll inv(ll b)



{



	if(b == 1)



	return 1;



	return (mod-mod/b)*inv(mod%b)%mod;



}



ll fac[N];



ll C(ll n,ll m)



{



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



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



}



ll ans[N][2];



int main()



{



	ll n,i,a,b,k;



	fac[0] = 1;



	fac[1] = 1;



	for(i = 2;i <= 3e5+5;i++)



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



	sl(n);sl(a);sl(b);sl(k);



	ll cnt = 0;



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



	{



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



		{



			ans[cnt][0] = i;



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



		}



	}



	ll res=0;



	for(i = 0;i < cnt;i++)



	{



		res = (res+C(n,ans[i][0])*C(n,ans[i][1])%mod)%mod;



	}



	pl(res);

	

	return 0;

	system("pause");

}


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

#include<algorithm>

#include<cmath>

#include<iostream>

#include<cstring>

#define ll long long

using namespace std;

const int D=998244353,MAXN=300005;

ll n,a,b,k,x,y,ans;

ll ifac[MAXN],fac[MAXN];

ll power_(ll x,ll k)

{

	ll ret=1;

	while(k)

	{

		if(k&1) ret=(ret*x)%D;

		x=(x*x)%D;

		k>>=1;

	}

	return ret;

}

void first_()

{

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

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

	ifac[n]=power_(fac[n],D-2);

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

		ifac[i-1]=(ifac[i]*i)%D;

}

ll C(ll aa,ll bb)

{

	if(bb<aa) return 0;

	return (fac[bb]*ifac[aa]%D*ifac[bb-aa])%D;

}

int main()

{

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

	first_();

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

	{

		if(a*i>k) break;

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

		{

			x=i;

			y=(k-a*i)/b;

			ans=(ans+C(x,n)*C(y,n)+D)%D;

		}

	}

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

	return 0;

}

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

//#include <windows.h>



int masu[100][100],mx,ice[100][100],n,m;



/**

void print()

{

	system("cls");

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

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

			printf("%d ",masu[i][j]);

		}

		puts("");

	}

}

/**/



void func(int x,int y,int now)

{

//	printf("%d",now);

//	print();

	

	if(masu[x+1][y]==1){

		masu[x][y]=0;

		func(x+1,y,now+1);

		masu[x][y]=1;

	}

	if(masu[x-1][y]==1){

		masu[x][y]=0;

		func(x-1,y,now+1);

		masu[x][y]=1;

	}

	if(masu[x][y+1]==1){

		masu[x][y]=0;

		func(x,y+1,now+1);

		masu[x][y]=1;

	}

	if(masu[x][y-1]==1){

		masu[x][y]=0;

		func(x,y-1,now+1);

		masu[x][y]=1;

	}

	else {

		if(mx<now){

			mx=now;

		}

	}

}



void func2()

{

	int i,j;

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

		for(j=1;j<=m;j++){

			masu[i][j]=ice[i][j];

		}

	}

}



int main(void)

{

	int i,j;

	

	while(scanf("%d%d",&m,&n),n,m){

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

			for(j=1;j<=m;j++){

				scanf("%d",&ice[i][j]);

			}

		}

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

			for(j=1;j<=m;j++){

				func2();

				if(masu[i][j]==1){

					func(i,j,1);

				}

			}

		}

		for(i=0;i<100;i++){

			for(j=0;j<100;j++){

				ice[i][j]=0;

				masu[i][j]=0;

			}

		}

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

		n=0;

		m=0;

		mx=0;

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int masu[100][100];

int n,m;

int ans,max;



void func(int x,int y){

	masu[x][y] = 0;

	ans++;

	if(max < ans) max = ans;

	if(masu[x][y+1] == 1 && y+1<100){

		func(x,y+1);

		masu[x][y+1] = 1;

	}

	if(masu[x][y-1] == 1 && y-1>-1){

		func(x,y-1);

		masu[x][y-1] = 1;

	}

	if(masu[x+1][y] == 1 && x+1<100){

		func(x+1,y);

		masu[x+1][y] = 1;

	}

	if(masu[x-1][y] == 1 && x-1>-1){

		func(x-1,y);

		masu[x-1][y] = 1;

	}

	masu[x][y] = 1;

	ans--;

}





int main(void){

	while(scanf("%d%d",&m,&n) && n && m){

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

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

				scanf("%d",&masu[i][j]);

			}

		}

		

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

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

				if(masu[i][j] == 1){

					ans=0;

					func(i,j);

				}

			}

		}

		

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

		max = 0;

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

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

				masu[i][j]=0;

			}

		}

	}

	return 0;

}

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

#include<iostream>

#include<cstring>

#include<string>

#include<algorithm>

using namespace std;

double dp[100010];

int N,M;

double p;

int g[20][20];

#define eps 1e-6

bool jud[20];

void dfs(int n)

{

    jud[n]=true;

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

    {

        if(g[n][i]&&!jud[i])

        {

            dfs(i);

        }

    }

}

int main()

{

    int i,j,k;

    int n,m,t;

    int a,b,s;

    scanf("%d%d%lf",&N,&M,&p);

    for(i=0;i<M;i++)

    {

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

        a--;b--;

        if(a==b)

        {

            i--;M--;

            continue;

        }

        g[a][b]=g[b][a]=1;

    }

    p/=100.0;

    if(p<eps)

    {

        dfs(0);

        for(i=0;i<N;i++) if(!jud[i]) break;

        if(i==N) printf("1.000000000000\n");

        else printf("0.000000000000\n");

        return 0;

    }



    if(p>1.0-eps)

    {

        if(N>1) printf("0.000000000000\n");

        else printf("1.000000000000\n");

        return 0;

    }



    for(i=0;i<N;i++) dp[(1<<i)]=1.0;

    double pp;

    for(n=1;n<(1<<N);n++)

    {

        //cout<<n<<endl;

        for(i=0;i<N;i++) if(n==(1<<i)) break;

        if(i<N) continue;

        for(a=0;a<N;a++) if(n&(1<<a)) break;

        for(b=0;b<N;b++) if((n&(1<<b))&&b!=a) break;

        for(m=n&(n-1);m;m=n&(m-1))

        {

            if(m&(1<<a)) continue;

            if(!(m&(1<<b))) continue;

            t=n&(~m);pp=1.0;

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

                if(((1<<i)&m)&&g[a][i]) pp*=p;

            pp=1.0/pp-1.0;

            dp[n]+=dp[m]*dp[t]*pp;

            //cout<<n<<"  "<<m<<"   "<<dp[n]<<endl;

        }

        //cout<<n<<"  "<<dp[n]<<endl;

    }

    for(i=0;i<M;i++) dp[(1<<N)-1]*=p;

    printf("%.12f\n",dp[(1<<N)-1]);

    return 0;

}

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

#include<cstring>

#include<cstdlib>

#include<cstring>

#include<cmath>

#define maxst 1<<20

using namespace std ;

int n , m , p , u , v ;

int r[maxst] ;

double f[maxst] ;



int main() {

	scanf("%d%d%d",&n,&m,&p) ;

	const int maxs = 1 << n;

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

		scanf("%d%d",&u,&v) ; 

		u-- ; v-- ;

		for(int j = 0 ; j < maxs ; j++) if((j&(1<<u)) && (j&(1<<v)))

		r[j]++ ;

	}

	for(int i = 1 ; i < maxs ; i++) if(i&1){

		f[i] = 1.0 ;

		for(int j = i&(i-1) ; j ; j = i&(j-1)) if(j&1)

			f[i] -= f[j] * pow(p*0.01 , r[i]-r[j]-r[(~j)&i]) ;

	}

	printf("%.9f\n",f[maxs-1]) ;

	return 0 ;

}

// Fastest known solution for this problem: