output_description: Print the number of the ways to paint tiles, modulo 998244353.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N A B K
attempt: # -*- coding: utf-8 -*-
  
  import sys
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def list2d(a, b, c):
      return [[c] * b for i in range(a)]
  
  
  def list3d(a, b, c, d):
      return [[[d] * c for j in range(b)] for i in range(a)]
  
  
  def list4d(a, b, c, d, e):
      return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
  
  
  def ceil(x, y=1):
      return int(-(-x // y))
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def LIST(N=None):
      return list(MAP()) if N is None else [INT() for i in range(N)]
  
  
  def Yes():
      print("Yes")
  
  
  def No():
      print("No")
  
  
  def YES():
      print("YES")
  
  
  def NO():
      print("NO")
  
  
  sys.setrecursionlimit(10**9)
  INF = 10**18
  MOD = 998244353
  
  
  class ModTools:
      """階乗たくさん使う時用のテーブル準備"""
  
      def __init__(self, MAX, MOD):
          """MAX：階乗に使う数値の最大以上まで作る"""
  
          MAX += 1
          self.MAX = MAX
          self.MOD = MOD
          # 階乗テーブル
          factorial = [1] * MAX
          factorial[0] = factorial[1] = 1
          for i in range(2, MAX):
              factorial[i] = factorial[i - 1] * i % MOD
          # 階乗の逆元テーブル
          inverse = [1] * MAX
          # powに第三引数入れると冪乗のmod付計算を高速にやってくれる
          inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)
          for i in range(MAX - 2, 0, -1):
              # 最後から戻っていくこのループならMAX回powするより処理が速い
              inverse[i] = inverse[i + 1] * (i + 1) % MOD
          self.fact = factorial
          self.inv = inverse
  
      def nCr(self, n, r):
          """組み合わせの数 (必要な階乗と逆元のテーブルを事前に作っておく)"""
  
          if n < r:
              return 0
          # 10C7 = 10C3
          r = min(r, n - r)
          # 分子の計算
          numerator = self.fact[n]
          # 分母の計算
          denominator = self.inv[r] * self.inv[n - r] % self.MOD
          return numerator * denominator % self.MOD
  
  
  N, A, B, K = MAP()
  
  ans = 0
  mt = ModTools(N, MOD)
  for x in range(N + 1):
      # 式変形：A * x + B * y = K → y = (K -  A * x) / B
      y = (K - A * x) / B
      if y < 0 or not y.is_integer():
          continue
      y = int(y)
      ans += mt.nCr(N, x) * mt.nCr(N, y)
      ans %= MOD
  print(ans)
  
problem_description: Statement
  
  Takahashi has a tower which is divided into N layers. Initially, all the
  layers are uncolored. Takahashi is going to paint some of the layers in red,
  green or blue to make a beautiful tower. He defines the _beauty of the tower_
  as follows:
  
    * The beauty of the tower is the sum of the scores of the N layers, where the score of a layer is A if the layer is painted red, A+B if the layer is painted green, B if the layer is painted blue, and 0 if the layer is uncolored.
  
  Here, A and B are positive integer constants given beforehand. Also note that
  a layer may not be painted in two or more colors.
  
  Takahashi is planning to paint the tower so that the beauty of the tower
  becomes exactly K. How many such ways are there to paint the tower? Find the
  count modulo 998244353. Two ways to paint the tower are considered different
  when there exists a layer that is painted in different colors, or a layer that
  is painted in some color in one of the ways and not in the other.
samples: [{"input": "4 1 2 5", "output": "40\n    \n\nIn this case, a red layer worth 1 points, a green layer worth 3 points and the\nblue layer worth 2 points. The beauty of the tower is 5 when we have one of\nthe following sets of painted layers:\n\n  * 1 green, 1 blue\n  * 1 red, 2 blues\n  * 2 reds, 1 green\n  * 3 reds, 1 blue\n\nThe total number of the ways to produce them is 40.\n\n* * *"}, {"input": "2 5 6 0", "output": "1\n    \n\nThe beauty of the tower is 0 only when all the layers are uncolored. Thus, the\nanswer is 1.\n\n* * *"}, {"input": "90081 33447 90629 6391049189", "output": "577742975"}]