#P11075. 不等关系 加强版

不等关系 加强版

Background

This problem is an enhanced version of Inequality Relations. It is recommended that you solve the original problem before challenging this enhanced version.

Problem Description

Given a string s1,s2,,sns_1,s_2,\cdots ,s_n consisting only of the two characters < and >.

Let f(s)f(s) be the number of permutations p1,p2,,pn+1p_1,p_2,\cdots ,p_{n+1} such that pi<pi+1p_i<p_{i+1} if and only if sis_i is <.

Now, please compute the sum of f(s)f(s) over all 2n2^n strings ss of length nn.

Since the answer may be large, you only need to output the result modulo 998244353998244353.

Input Format

One line containing a positive integer nn.

Output Format

One line containing an integer, representing the number of permutations satisfying the requirement modulo 998244353998244353.

1
2

Hint

Sample Explanation

For the string s1=s1= <, there is exactly one permutation (1,2)(1,2) that satisfies the requirement, so f(s1)=1f(s1)=1.

For the string s2=s2= >, there is exactly one permutation (2,1)(2,1) that satisfies the requirement, so f(s2)=1f(s2)=1.

Therefore, the answer is f(s1)+f(s2)=2f(s1)+f(s2)=2.

Constraints

Test Point ID n=n=
11
22
33
44 55
55 1010
66 1515
77 2020
88 3030
99 5050
1010 100100

For all testdata, it is guaranteed that 1n1001\le n\le 100.

Translated by ChatGPT 5