题目描述
Problem Background
Original Problem Link
The difference between this problem and the original one is only in the modulus and data range.

Problem Description
Given a positive integer \( n \), determine how many strings of length \( n \) are "program fragments".
The definitions are as follows:
- A single semicolon
;is a "statement". - An empty string is a "program fragment".
- If string
Ais a "program fragment" and stringBis a "statement", thenABis a "program fragment". - If string
Ais a "program fragment", then{A}is a "statement block". - If string
Ais a "statement block", thenAis a "statement", and[]Aand[]()Aare both "functions". - If string
Ais a "function", then(A)is a "function", and bothAandA()are "values". - If string
Ais a "value", then(A)is a "value", andA;is a "statement".
Note: A being B does not imply B is A.
Input Format
Input consists of a single line containing a positive integer \( n \).
Output Format
Output a single integer representing the answer, modulo \( 998244353 \).
Sample Input and Output
Sample Input #1
4
Sample Output #1
9
Sample Input #2
7
Sample Output #2
140
Sample Input #3
8923
Sample Output #3
424180943
Sample Input #4
114514
Sample Output #4
552971057
Notes
Sample 1 Explanation
Valid "program fragments" include: ;;;;, ;;{}, ;{;}, ;{};, {;;}, {;};, {{}}, {};;, {}{}.
Data Range
- For 30% of the data, \( 1 \le n \le 10^5 \).
- For 100% of the data, \( 1 \le n \le 10^7 \).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
4
样例输出
9