#P7957. Yiwen with Formula

Yiwen with Formula

Yiwen with Formula

Problem Description

Given an array aa of length nn, for any array bb satisfying 1bin1 \leq b_i \leq n and b1<b2<<bkb_1<b_2<\cdots<b_k (kk is the length of bb, k1k \geq 1), calculate:

$$\prod_{b_1<b_2<\cdots<b_k} (a_{b_1}+a_{b_2}+\cdots+a_{b_k}) $$

Input

The input consists of multiple test cases. The first line contains an integer TT (1T101 \leq T \leq 10) -- the number of test cases. For each test case: The first line contains an integer nn (1n1051 \leq n \leq 10^5), which is the length of aa. The second line contains nn integers aia_i (0ai1050 \leq a_i \leq 10^5), which is the array aa. It is guaranteed that:

  • The sum of nn over all test cases will not exceed 2.5×1052.5 \times 10^5.
  • The sum of aia_i in a single test will not exceed 10510^5.
  • The sum of aia_i over all test cases will not exceed 4×1054\times 10^5.

Output

For each test case, output the result modulo 998244353998244353 in a single line.

Sample Input

3

2

1 1

3

1 1 2

5

4 6 9 1 5

Sample Output

2

144

417630946

Source

2021“MINIEYE杯”中国大学生算法设计超级联赛(7)