Zig-zag
시간 제한12초메모리 제한1024 MB
자연수 n을 양의 정수들의 합으로 나타낼 때, 인접한 항이 번갈아 오르내리는 지그재그 수열이 되는 가짓수를 998244353으로 나눈 나머지로 구한다. 질의는 최대 300000개다.
문제
Zack’s Zergonomics Zegree has taught him that the optimal way to display items in a store is to stack them into a zig-zag pattern.
Zack needs to display boxes lined up on the storefront, each one containing an action figure. These boxes can be stacked on top of one another, and they are identical and indistinguishable from each other. His goal is to decide the number of stacks, and then stack up the boxes such that each stack is non-empty, and the numbers of boxes in the stacks form a zig-zag sequence.
Formally, if there are () stacks numbered to from left to right, and stack contains boxes, then the following conditions must be satisfied:
-
for each from to ,
-
, and
-
at least one of the following is true:
- , or
For example, for , there are ways as illustrated by Figure M.1.

Figure M.1: All possible ways for .
Find the number of different ways Zack can stack boxes modulo .
Two ways are considered the same if and only if the number of stacks is the same, and pairs of stacks at the same positions have the same number of boxes.
입력
The first line of input contains one integer () representing the number of test cases. After that, test cases follow. Each of them consists of a single line containing one integer ().
출력
For each test case, output an integer representing the number of different ways to stack boxes modulo .