AlgoUniversity
  • Go Back
Discussion
Dice Palindrome :

Author

Akash

Difficulty Level : Medium

Submissions : 73

Asked In : Tekion

Marks :10

: 1 | : 0

A dice is thrown $$$n$$$ times and the outcomes are used to form a $$$n$$$ digit number in the same order they are thrown. Find the probability that the number thus formed is a palindrome. Each throw can result in 1 to 6.

It can be shown that this can be represented as $$$\frac{P}{Q}$$$, where P and Q are coprime integers, and $$$Q\not\equiv 0$$$ $$$(mod$$$ $$$998244353)$$$. Print the value of $$$P·Q^{-1}$$$ modulo $$$998244353.$$$

$$$\textbf{Constraint}$$$

$$$1$$$ $$$\le$$$ $$$n$$$ $$$\le$$$ $$$10^{5}$$$

Input

The first line contains an integer $$$n$$$, the number of times the dice is thrown.

Output

Print a single integer, the answer to the problem.

Example

Input
3
Output
166374059

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.