#P7957. Yiwen with Formula
Yiwen with Formula
Yiwen with Formula
Problem Description
Given an array of length , for any array satisfying and ( is the length of , ), 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 () -- the number of test cases. For each test case: The first line contains an integer (), which is the length of . The second line contains integers (), which is the array . It is guaranteed that:
- The sum of over all test cases will not exceed .
- The sum of in a single test will not exceed .
- The sum of over all test cases will not exceed .
Output
For each test case, output the result modulo 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)