Raiden Shogun, the ruler of Inazuma, is playing a new card game invented by her friend Yae Miko.

Pixiv ID: 93716380
The player needs to defeat a monster of health point (HP) $$$n$$$ by using magic cards properly.
Specifically, there are three kinds of magic cards:
At the beginning of each turn, the player receives a new card from one of the three kind in equal possibility of $$$\frac{1}{3}$$$. Then the player can choose to cast some magic cards in his hand one by one and the casted cards will take effect respectively. Since there is no limitation for the number of cards in hand, the player can choose to keep cards and do nothing in the turn.
The monster will be defeated if its HP becomes nonpositive. Now Raiden Shogun hopes you can calculate the expected number of turns to defeat the monster if she plays optimally to minimize the expected number of turns.
The only line contains a single integer $$$n$$$ $$$(1 \le n \le 2 \times 10^5)$$$, indicating the monster's HP.
Output a line containing an integer, indicating the expected number of turns to defeat the monster modulo $$$998\,244\,353$$$ if playing optimally.
More precisely, if the reduced fraction of the answer is $$$\frac{p}{q}$$$, what you should provide is the minimum nonnegative integer $$$r$$$ such that $$$q r \equiv p \pmod{998\,244\,353}$$$. You may safely assume that such $$$r$$$ always exists.
1
831870296
5
835978299
In the first sample case:
In all, the expected number of turns to defeat the monster of HP $$$1$$$ is $$$\frac{11}{6}$$$ if playing optimally.
| Название |
|---|


