C. Osiris
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

"My name is D'Arby, D-A-R-B-Y. The "D" has an apostrophe."

The Stardust Crusaders, after a long journey, finally arrived at their destination—Cairo, Egypt. They immediately visited a nearby café to inquire about Dio's mansion. A customer there calmly remarked, "I recall that mansion." When Joseph Joestar pressed for details, the customer demanded a gamble in exchange for information. Joseph and Polnareff wagered against this customer, the enemy Stand Master Daniel J. D'Arby, but lost and had their souls stolen. To reclaim their souls, Kujo Jotaro challenges D'Arby...

Jotaro and D'Arby play a poker game under these rules: They use a shuffled 52-card deck (no jokers)$$$^{\text{∗}}$$$, and each initially draws 5 random cards. Players know only their own hands. Jotaro can discard $$$k\ (k \gt 0)$$$ of his cards (without returning them to the deck) and draw $$$k$$$ new cards from the remaining deck. After this, both reveal their hands and compare the total point sums. If Jotaro's sum exceeds D'Arby's, he gains $$$k$$$ chips; if his sum is smaller, he loses $$$k$$$ chips; if equal, the chips remain unchanged.

Jotaro wants to compute the maximum expected value of chips he can obtain for each $$$k=1,2,\cdots,5$$$, assuming he makes optimal decisions when discarding and redrawing cards. Specifically, for each $$$k$$$, calculate the expected value of the maximum possible chip outcome.

All answers must be computed modulo $$$998244353$$$$$$^{\text{†}}$$$.

$$$^{\text{∗}}$$$The deck contains 52 cards with 13 ranks (A, 2-10, J, Q, K) and 4 suits per rank. Here, A is treated as 1, J as 11, Q as 12, and K as 13.

$$$^{\text{†}}$$$Regarding modulo operation on fractions: For a fraction $$$\dfrac{a}{b}$$$, the calculation formula is $$$\dfrac{a}{b} \bmod p = (a \cdot b^{-1}) \bmod p$$$, where $$$b^{-1}$$$ is the multiplicative inverse of $$$b$$$ under modulo $$$p$$$, satisfying $$$b \cdot b^{-1} \equiv 1 \pmod{p}$$$. For example, under modulo $$$5$$$, the inverse of $$$3$$$ is $$$2$$$, because $$$3 \times 2 \equiv 1 \pmod{5}$$$. Therefore, $$$\dfrac{2}{3} \bmod 5 = (2 \times 2) \bmod 5 = 4$$$.

Input

One line with five space-separated values (integers or uppercase letters) representing Jotaro's initial cards.

Valid inputs are: A, 2-10, J, Q, K.

It is guaranteed that each value in the input will appear at most 4 times, as there are only 4 cards of each value in the deck.

Output

Five lines, where the $$$i$$$-th line ($$$1 \leq i \leq 5$$$) contains the expected value for $$$k = i$$$, modulo $$$998244353$$$.

Examples
Input
A A A A Q
Output
79189732
281328086
60649431
607386498
0
Input
8 6 8 10 J
Output
672098766
396700559
282487893
144365991
0