#B3718. Dice Probability
Dice Probability
Dice Probability
You are given ( n ) six-sided dice. Each die, when tossed, lands on one of its six faces with equal probability, and the outcome of each die is independent.
When all the dice are tossed, what is the probability that exactly ( m ) dice show the face with one dot? In other words, the probability is
[
P = \binom{n}{m}\left(\frac{1}{6}\right)^m\left(\frac{5}{6}\right)^{n-m} = \binom{n}{m}\frac{5^{n-m}}{6^n}.
]
Since the answer can be a rational number, you are asked to compute the value of ( P ) modulo (998,244,353).
inputFormat
The input consists of a single line containing two integers ( n ) and ( m ) (with (0 \le m \le n)).
outputFormat
Output a single integer, which is the value of ( P ) modulo (998,244,353).
sample
1 1
166374059