时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
Special Judge, 64bit IO Format: %lld
题目描述
The game consists of

levels, and you know in advance the probability of passing each level, given as

, where

are non-negative integers.
You can perform any number of operations. Each operation allows you to choose an index
)
and decrement

by one while incrementing

by one.
After performing operations, you start the game, aiming to maximize the probability of passing all levels.
Output the maximum probability multiplied by

modulo

.
输入描述:
The first line contains a positive integer
, indicating the number of test cases.For each test case:
The first line contains a positive integer
.
The second line contains
non-negative integers
.
输出描述:
For each test case, output one non-negative integer, representing the result of the maximum probability multiplied by
modulo
.
示例1
输入
复制
5
4
1 2 3 4
4
4 3 2 1
2
2 2
1
1
2
2 3
备注:
.