stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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'

;}

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

#define LL long long

using namespace std;

const int N=300010,mod=998244353;

int ksm(int a,int b=mod-2,int c=mod){

	int ans=1;

	while(b){

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

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

	}

	return ans;

}

int n,a,b,c[N],ans;

LL k;

int main(){

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

	c[0]=1;

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

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

	}

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

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

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

			ans+=(LL)c[i]*c[j]%mod;

			if(ans>=mod)ans-=mod;

		}

	}

	cout<<ans<<endl;

}
// Slower C++ solution:
#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;

}

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

#define LL long long

using namespace std;

const int N=300010,mod=998244353;

int ksm(int a,int b=mod-2,int c=mod){

	int ans=1;

	while(b){

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

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

	}

	return ans;

}

int n,a,b,c[N],ans;

LL k;

int main(){

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

	c[0]=1;

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

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

	}

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

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

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

			ans+=(LL)c[i]*c[j]%mod;

			if(ans>=mod)ans-=mod;

		}

	}

	cout<<ans<<endl;

}
// Slower C++ solution:
#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'

;}

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

#include<iostream>

#define maxn 3*100000+5

#define mod 998244353

using namespace std;

long long int a[maxn],in[maxn];

long long pow(long long x, long long n) {

    long long ret = mod!= 1;

    for (x %= mod; n; n >>= 1, x = x * x % mod)

        if (n & 1) ret = ret * x % mod;

    return ret;

}

 long long int mate( long long int m,  long long int n)

{

    if(m==0) return 1;

    if(n<m) return 0;

    if(n==m)  return 1;

        return a[n]*in[m]%mod*in[n-m]%mod;



}

int main()

{

    long long int sum=0,A,B,K,x,t,N,j,r,i;

    scanf("%lld%lld%lld%lld",&N,&A,&B,&K);

    a[0]=1;

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

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

        in[N]=pow(a[N],mod-2);

        for(i=N-1;i>=0;i--)

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

    if(K==0)

        {

            printf("1\n");

            return 0;

        }

    t=0;

    x=0;

    while(t<=N)

    {

        if((K-t*A)%B) {t++;continue;}

        x=(K-t*A)/B;

        if(x<=N&&t>=0&&x>=0)

        {

            sum=(sum+(mate(t,N)*mate(x,N))%mod)%mod;

        }

       t++;

    }

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

}
// Slower C++ solution:
#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;

}

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

#include<iostream>

#define maxn 3*100000+5

#define mod 998244353

using namespace std;

long long int a[maxn],in[maxn];

long long pow(long long x, long long n) {

    long long ret = mod!= 1;

    for (x %= mod; n; n >>= 1, x = x * x % mod)

        if (n & 1) ret = ret * x % mod;

    return ret;

}

 long long int mate( long long int m,  long long int n)

{

    if(m==0) return 1;

    if(n<m) return 0;

    if(n==m)  return 1;

        return a[n]*in[m]%mod*in[n-m]%mod;



}

int main()

{

    long long int sum=0,A,B,K,x,t,N,j,r,i;

    scanf("%lld%lld%lld%lld",&N,&A,&B,&K);

    a[0]=1;

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

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

        in[N]=pow(a[N],mod-2);

        for(i=N-1;i>=0;i--)

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

    if(K==0)

        {

            printf("1\n");

            return 0;

        }

    t=0;

    x=0;

    while(t<=N)

    {

        if((K-t*A)%B) {t++;continue;}

        x=(K-t*A)/B;

        if(x<=N&&t>=0&&x>=0)

        {

            sum=(sum+(mate(t,N)*mate(x,N))%mod)%mod;

        }

       t++;

    }

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

}
// Slower C++ solution:
#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'

;}

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


#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;



}
// Slower C++ solution:
#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'

;}

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

}
// Slower C++ solution:
#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;

}

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

}
// Slower C++ solution:


#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;



}


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

}
// Slower C++ solution:
#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'

;}

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



typedef long long ll;

const int maxn = 300010;

const ll mod = 998244353;



ll n,a,b,k;

ll fac[maxn],inv[maxn];



ll qpow_mod(ll x,ll n){

	int s = 1;

	while(n){

		if(n&1) s=s*x % mod;

		x = x*x % mod;

		n >>= 1;

	}

	return s;

}

void csh(){

	fac[0] = 1;

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

	inv[300000] = qpow_mod(fac[300000],mod-2);

	for(int i = 300000; i>0; i--) inv[i-1] = inv[i]*i % mod;

}

ll C(ll n, ll a){//C n 取 a 

	return fac[n]*inv[a] %mod * inv[n-a] %mod; 

}

int main()

{

	csh();

	ll ans = 0;

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

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

		if((k - a*i)%b != 0 || (k - a*i)/b > n || (k - a*i)<0)continue;

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

	}

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

	return 0;

}
// Slower C++ solution:


#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");

}


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

}
// Slower C++ solution:


#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");

}


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

using namespace std;

long long mod=998244353;

long long n,a,b,c,k,ans;

long long fac[300005],rev[300005];

long long power(long long x,long long y,long long mod){

	if(y==0){

		return 1;

	}else{

		long long dm=power(x,y/2,mod);

		if(y%2==1){

			return ((dm*dm)%mod*x)%mod;

		}else{

			return (dm*dm)%mod;

		}

	}

}

long long inverse_mod(long long a,long long mod){

	return power(a,mod-2,mod);

}

long long C(int k,int n){

	if(k>n){

		return 0;

	}else{

	    return ((fac[n]*rev[k]%mod)*rev[n-k])%mod;

	}

}

int main(){

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

	fac[0]=1;

	rev[0]=inverse_mod(fac[0],mod);

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

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

		rev[i]=inverse_mod(fac[i],mod)%mod;

	}

	if(k==0){

		cout<<"1";

	}else{

		for(long long x=1;x<=k/a&&x<=n;x++){

			long long tmp=k-a*x;

			if(tmp%b==0){

				long long y=tmp/b;

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

			}

		}

		cout<<ans;

	}

}
// Slower C++ solution:


#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");

}


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

using namespace std;

#define int long long

#define vt vector

#define pb push_back

#define pob pop_back

#define vi vt<int>

#define vvi vt<vi>

#define vii vt<ii>

#define vvii vt<vii>

typedef long long ll;

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

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

#define roF(i,a,b) for(int i = a - 1; i >= b; i--)

#define Rof(i,a,b) for(int i = a; i >= b; i--)



int C[300001];

int mod = 998244353;



int binpow(int a, int b){

	if(b == 0){

		return 1;

	}

	if(b == 1){

		return a;

	}

	int temp = binpow(a,b>>1);

	if(b&1){

		return temp*temp%mod*a%mod;

	}else{

		return temp*temp%mod;

	}

}



signed main (){

	/*

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

	freopen(".out","w",stdout);

	*/

	int n, a, b, k, t = 0;

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

	int allsum = 0;

	C[0] = 1;

	foR(i,1,n){

		C[i] = C[i-1]*(n-i+1)%mod*binpow(i,mod-2)%mod;

//		cout << binpow(i,mod-2)%mod << " ";

//		cout << C[i] << "\n";

	}

	foR(i,0,n){

		if((k-t)%b == 0 && (k-t)/b <= n){

//			cout <<"find " << i << " " << (k-t)/b << "\n";

//			cout << C[i] << " " << C[(k-t)/b] << " " << C[i]*C[(k-t)/b]%998244353 << "\n";

			allsum = (allsum + C[i]*C[(k-t)/b])%mod;

		}

		t += a;

		if(t > k){

			break;

		}

	}

	cout << allsum;

}