atcoder#AGC040C. [AGC040C] Neither AB nor BA

[AGC040C] Neither AB nor BA

Score : 800800 points

Problem Statement

Given is a positive even number NN.

Find the number of strings ss of length NN consisting of A, B, and C that satisfy the following condition:

  • ss can be converted to the empty string by repeating the following operation:- Choose two consecutive characters in ss and erase them. However, choosing AB or BA is not allowed.
  • Choose two consecutive characters in ss and erase them. However, choosing AB or BA is not allowed.

For example, ABBC satisfies the condition for N=4N=4, because we can convert it as follows: ABBC → (erase BB) → AC → (erase AC) → (empty).

The answer can be enormous, so compute the count modulo 998244353998244353.

Constraints

  • 2N1072 \leq N \leq 10^7
  • NN is an even number.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the number of strings that satisfy the conditions, modulo 998244353998244353.

2
7

Except AB and BA, all possible strings satisfy the conditions.

10
50007
1000000
210055358