| Soy Cup #2: Vivian |
|---|
| Finished |
As a big eater of the Collective of Plenty, Varesa is, of course, a devoted lover of barbecue. Today, she is given $$$n$$$ skewers, where the $$$i$$$-th skewer contains $$$a_i$$$ pieces of meat.
Varesa has a peculiar eating habit: she insists on keeping her molars balanced. For each skewer, she picks a side—either left or right—at random. The first piece of meat goes to that side, the second to the other side, the third to the original side, and so on, alternating as she goes.
However, she can never remember which side she started with for any previous skewer, so she just picks randomly every time.
Varesa considers her meal to be balanced if the total number of pieces chewed with her left and right molars differs by at most $$$1$$$. Given the number of pieces on each skewer, help her calculate the probability that her eating ends up being balanced. To avoid precision errors, you need to output the answer modulo $$$998244353$$$.
Formally, let $$$M = 998244353$$$. It can be shown that the exact answer can be expressed as an irreducible fraction $$$\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \not \equiv 0 \pmod{M}$$$. Output the integer equal to $$$p \cdot q^{-1} \bmod M$$$. In other words, output such an integer $$$x$$$ that $$$0 \le x \lt M$$$ and $$$x \cdot q \equiv p \pmod{M}$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains one integer $$$n$$$ ($$$1\le n\le2\cdot10^5$$$).
The second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\dots,a_n$$$ ($$$1\le a_i\le10^9$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot10^5$$$.
For each test case, output one integer — the probability of being balanced modulo $$$998244353$$$.
2111451461 1 4 5 1 4
1 623902721
In the second sample case, the answer is $$$\frac{3}{8}$$$.
| Name |
|---|


