Buggy python submission (verdict: Runtime Error):
N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        t = (num*num)%mod
        t = (t*table[i])%mod
        t = (t*table[j])%mod
        t = (t*table[N-i])%mod
        t = (t*table[N-j])%mod
        number = (number+t)%mod
print(number)

Fixed submission:
N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N+1):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        if 0<=j<=N:
            t = (num*num)%mod
            t = (t*table[i])%mod
            t = (t*table[j])%mod
            t = (t*table[N-i])%mod
            t = (t*table[N-j])%mod
            number = (number+t)%mod
print(number)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import sys
sys.setrecursionlimit(10**7) 

N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        t = (num*num)%mod
        t = (t*table[i])%mod
        t = (t*table[j])%mod
        t = (t*table[N-i])%mod
        t = (t*table[N-j])%mod
        number = (number+t)%mod
print(number)

Fixed submission:
N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N+1):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        if 0<=j<=N:
            t = (num*num)%mod
            t = (t*table[i])%mod
            t = (t*table[j])%mod
            t = (t*table[N-i])%mod
            t = (t*table[N-j])%mod
            number = (number+t)%mod
print(number)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import sys
sys.setrecursionlimit(10**7) 

N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N):
    if (K-A*i)%B==0:
        j=(K-A*i)//B
        t = (num*num)%mod
        t = (t*table[i])%mod
        t = (t*table[j])%mod
        t = (t*table[N-i])%mod
        t = (t*table[N-j])%mod
        number = (number+t)%mod
print(number)

Fixed submission:
N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N+1):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        if 0<=j<=N:
            t = (num*num)%mod
            t = (t*table[i])%mod
            t = (t*table[j])%mod
            t = (t*table[N-i])%mod
            t = (t*table[N-j])%mod
            number = (number+t)%mod
print(number)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import sys
sys.setrecursionlimit(10**7) 

N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N):
    if (K-A*i)%B==0:
        j=(K-A*i)//B
        t = (num*num)%mod
        t = (t*table[i])%mod
        t = (t*table[j])%mod
        t = (t*table[N-i])%mod
        t = (t*table[N-j])%mod
        number = (number+t)%mod
print(number)

Fixed submission:
N,A,B,K=map(int,input().split())
mod = 998244353
#x!のmodP逆元を求めるx^-1=x^(p-2)
table=[1]
a=1
for i in range(1,N+1):
    a=(a*pow(i,mod-2,mod))%mod
    table.append(a)

num=1
for i in range(1,N+1):
    num = (num*i) %mod


number =0
for i in range(N+1):
    if (K-A*i)%B==0 and K-A*i>=0:
        j=(K-A*i)//B
        if 0<=j<=N:
            t = (num*num)%mod
            t = (t*table[i])%mod
            t = (t*table[j])%mod
            t = (t*table[N-i])%mod
            t = (t*table[N-j])%mod
            number = (number+t)%mod
print(number)