Limits 1s, 512 MB

Parentheses sequence of length 2n2n is the sequence containing exactly nn opening parentheses «(»«(» and exactly nn closing parentheses «)»«)»

A parentheses sequence is called balanced if one can turn it into a valid math expression by adding characters «+»«+» and «1»«1». For example, sequences «(())()»«(())()», «()»«()» and «(()(()))»«(()(()))» are balanced, while «)(»«)(», «(()»«(()» and «(()))(»«(()))(» are not.

A parentheses sequence, ss of length 2n2n is called interesting if one can turn it balanced by doing the following operation at most once.

  • Select two indices i,j(1i,j2n)i, j (1 \le i,j \le 2n) and swap s[i]s[i] and s[j]s[j].

You have to calculate the number of different interesting parentheses sequence of length 2n2n, and print it modulo 998244353998244353.

Input

First line will contain T(1T103)T ( 1 \le T \le 10^3 ), the number of test cases. Each of the next TT lines will contain one integer n(1n103)n (1 \le n \le 10^3), half the length of the interesting parentheses sequence.

Output

For each testcase, print one line containing an integer ans(0ans<998244353)ans (0 \le ans \lt 998244353), which is the number of different interesting parentheses sequence modulo 998244353998244353.

Sample

InputOutput
3
1
2
100
2
6
829549001

In the first test case, there are 22 interesting parentheses sequence, these are as follows.

  1. ()()

  2. )()(

In the second test case, there 66 interesting parentheses sequence, these are as follows.

  1. (())(())

  2. ()()()()

  3. ())(())(

  4. )(())(()

  5. )()()()(

  6. ))(())((

Submit

Login to submit.

Statistics

95% Solution Ratio
niaj_pialEarliest, Feb '23
Kuddus.6068Fastest, 0.0s
nusuBotLightest, 4.9 MB
rkb_rdShortest, 606B
Toph uses cookies. By continuing you agree to our Cookie Policy.