#K57337. Final Sum Reduction
Final Sum Reduction
Final Sum Reduction
In this problem, you are given test cases. For each test case, you have an integer and a list of integers. Your task is to compute the sum of the integers modulo . This operation is interpreted as performing exactly reductions until a single integer remains, which is equivalent to computing the sum modulo . For example, if the given list is [1,2,3], the final result is .
inputFormat
The input begins with an integer , the number of test cases. For each test case, the first line contains an integer . The second line contains space-separated integers.
outputFormat
For each test case, output a single line containing the final sum of the integers modulo .## sample
1
3
1 2 3
6
</p>