Rocq the rooster owns a single egg. One day, he came back home and noticed his egg was missing! The egg is rolling around in a field — in fact, the field $$$\mathbb{Z}_p$$$, where $$$p$$$ is a prime. His egg has been studying number theory, and he knows that his egg used the following procedure to determine what path to roll away with:
It is guaranteed the egg will eventually roll in a cycle between different locations. If Rocq can find out the expected length of the cycle, he can somehow catch the egg. Given the prime $$$p$$$, help him by finding this expectation! He doesn't like decimals, so output the answer mod $$$998244353$$$.
More formally, let $$$P = 998244353$$$. It can be shown that the answer can be represented as an irreducible fraction $$$\frac{a}{b}$$$, where $$$a$$$ and $$$b$$$ are integers and $$$b \not\equiv 0 \pmod P$$$. Output the integer $$$x$$$ such that $$$0 \leq x \lt P$$$ and $$$x \equiv a \cdot b^{-1} \pmod P$$$.
The input will consist of a single integer $$$p$$$ ($$$1 \leq p \leq 2 \cdot 10^5$$$) — the size of field the egg travels in. It is guaranteed that $$$p$$$ is a prime.
Output the expected length of the cycle the egg ends up in, mod $$$998244353$$$.
2
748683266
5
760262901
The answer for the $$$p = 2$$$ is $$$\frac{5}{4}$$$, and $$$5 \cdot 4^{-1} \bmod 998244353 = 748683266$$$.
| Name |
|---|


