#P7796. Game on a Circle

Game on a Circle

Game on a Circle

Problem Description

There are nn stones on a circle, numbered from 11 to nn in the clockwise direction such that the next of the ii-th stone is the (i+1)(i + 1)-th one (i=1,2,,n1)(i = 1, 2, \ldots, n - 1) and the next of the nn-th stone is the first one. At the beginning of this game, all the stones exist. You will start from the first stone, and then repeatedly do the following operation until all the stones have been erased:

  1. erase the current stone with probability pp, and
  2. move to the next stone that hasn't been erased in the clockwise direction. Now your task is, for i=1,2,,ni = 1, 2, \ldots, n, to calculate the probability that the ii-th earliest erased stone is the cc-th one. Due to the precision issue, you are asked to report the probabilities in modulo 998244353998244353 (223×7×17+12^{23} \times 7 \times 17 + 1, a prime). For example, if the irreducible fraction of some output value is xy\frac{x}{y}, then you are asked to output the minimum possible non-negative integer zz such that xyz(mod998244353)x \equiv y z \pmod{998244353}.

Input

There are several test cases. The first line contains an integer TT (1T100)(1 \leq T \leq 100), denoting the number of test cases. Then follow all the test cases. For each test case, the only line contains four integers nn, aa, bb and cc (1cn106,0<a<b<998244353)(1 \leq c \leq n \leq 10^6, 0 < a < b < 998244353), representing that the number of stones is nn, the probability pp is ab\frac{a}{b} and the special stone is the cc-th one. It is guaranteed that the sum of nn in all test cases is no larger than 10610^6. It is also guaranteed that (1p)i≢1(mod998244353)(1 - p)^i \not\equiv 1 \pmod{998244353} for i=1,2,,ni = 1, 2, \ldots, n in each test case.

Output

For each test case, output nn lines, where the ii-th line contains an integer, denoting the probability, in modulo 998244353998244353, that the ii-th earliest erased stone is the cc-th one.

Sample Input

2
3 1 2 2
4 1 3 3

Sample Output

713031681
570425345
713031681
706449850
560148451
952979832
775154927

Hint

For the first sample case, the irreducible fractions of the output values are [2/7, 3/7, 2/7]. For the second sample case, the irreducible fractions of the output values are [12/65, 356/1235, 333/1235, 318/1235].

Source

2020 Multi-University Training Contest 3