A large company has to schedule the order of $$$n$$$ events.
There are no dependencies between those events, so each permutation of them is a valid schedule. To find the best order, the boss assigned the following task to some employee: Look at all possible schedules; and for each of them report a score which is an integer between $$$1$$$ (bad) and $$$n$$$ (good). Since the number of schedules is too large to look at each of them individually, the employee decides to assign scores to the schedules uniformly and independently at random.
The next obvious question for someone who enjoys math is: What is the expected value of the minimum score which is assigned to some schedule?
The input consists of:
Output one integer, the expected value modulo $$$998\,244\,353$$$.
Formally, let $$$M = 998\,244\,353$$$. It can be shown that the answer can be expressed as an irreducible fraction $$$\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \not \equiv 0 \pmod{M}$$$. Output the integer equal to $$$p \cdot q^{-1} \bmod M$$$. In other words, output such an integer $$$x$$$ that $$$0 \le x \lt M$$$ and $$$x \cdot q \equiv p \pmod{M}$$$.
1
1
2
748683266
3
195814737
In the first test case, there is only one possible schedule and it can only be assigned score 1. Thus, the answer is one.
In the second test case, there are two possible schedules. If both of them are assigned score 2, then the minimum score is 2. This happens with probability $$$\frac{1}{4}$$$. Otherwise, the minimum score is 1. Thus, the answer is $$$\frac{1}{4} \cdot 2 + \frac{3}{4} \cdot 1 = \frac{5}{4}$$$.
In the third test case, there are six possible schedules.