AtCoder Grand Contest 040
C
Neither AB nor BA
AtCoder
⌀ 2740
原题
← BD →
翻译中…

Problem Statement

翻译中…

Given is a positive even number $N$.

翻译中…

Find the number of strings $s$ of length $N$ consisting of A, B, and C that satisfy the following condition:

翻译中…
  • $s$ can be converted to the empty string by repeating the following operation:
  • Choose two consecutive characters in $s$ and erase them. However, choosing AB or BA is not allowed.
翻译中…

For example, ABBC satisfies the condition for $N=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 $998244353$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 10^7$
  • $N$ is an even number.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the number of strings that satisfy the conditions, modulo $998244353$.

翻译中…

样例

Input #1
2
Output #1
7
Except `AB` and `BA`, all possible strings satisfy the conditions.
Input #2
10
Output #2
50007
Input #3
1000000
Output #3
210055358
题目信息
题号
agc040_c
时间限制
4 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。