F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Paperfolding

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 881    Accepted Submission(s): 514


Problem Description
There is a piece of paper in rectangular shape with sufficient length and width (lay flat on the table). Execute an operation instruction according to a string of length $n$ from left to right that only contains $4$ different characters of $L$,$R$,$U$,$D$.

1. $L$ instruction means to fold it from left to right,

2. $R$ instruction means to fold from right to left,

3. $U$ instruction means to fold from top to bottom,

4. $D$ instruction means to fold in half from bottom to top.

Note that the operation is limited due to the limitation of the desktop. Namely, the fold operation is restricted. For example, if you fold the paper from left to right, you should let the left side overlap on the right side with no rotation.

Now, cut a knife horizontally (completely cut) at the center of the visible part of the paper, and then cut vertically (completely cut).

The number of pieces of the whole paper split is $num(S)$.

See the example and the picture for better understanding.

Now given a nonnegative integer $n$, the string $S$ is generated from $4^n$ different possible outcomes in equal probability. Find the expected value of the number of pieces of the paper which is split, that is $E(num(S))$ mod $998244353$.

It can be shown that the answers can be represented by $\frac{P}{Q}$, where $P$ and $Q$ are coprime integers, and print the value of $P \times Q^{-1} \ mod $ $\space 998244353$.
 

Input
The first line contains a single integer $ T $ ($1 \le T \le 10^5$), the number of testcases.

Each of the next $ T $ lines contains a number $ n $ ( $0 \le n \le 10^{18} $ ).
 

Output
For each testcase, print the answer in one line.
 

Sample Input
2 0 1
 

Sample Output
4 6
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 07:42:13, Gzip enabled