Colin recently received a gift from Eva: - a mysterious ascending random number sequence generator! You only need to input a positive integer $$$n$$$, and the generator will return an ascending sequence to you! After repeated experiments, Colin figured out how the generator works.
Initially, the generator will create a new empty sequence and select a number $$$k$$$ from $$$\{1,2,\cdots, n\}$$$ with equal probability.
Then, the generator will select a number $$$x$$$ from $$$\{1,2,\cdots, n\}$$$ with equal probability as the first element of the sequence.
Next, the generator will repeat the following process:
Now Colin wants to know, for a given $$$n$$$, what the expected length of the sequence returned by the generator is?
A single integer $$$n\ (1\le n\le 10^7)$$$.
A single integer, representing the expected length modulo $$$998244353$$$.
3
55458021
Thus, the answer is $$$(1+\frac{4}{3}+\frac{11}{6})/3=\frac{25}{18}$$$.
The inverse of $$$18$$$ modulo $$$998244353$$$ is $$$720954255$$$, so the output result is $$$25\times 720954255 \bmod 998244353=55458021$$$.
| Название |
|---|


