#K57337. Final Sum Reduction

    ID: 30398 Type: Default 1000ms 256MiB

Final Sum Reduction

Final Sum Reduction

In this problem, you are given TT test cases. For each test case, you have an integer NN and a list of NN integers. Your task is to compute the sum of the integers modulo 109+910^9+9. This operation is interpreted as performing exactly N1N-1 reductions until a single integer remains, which is equivalent to computing the sum modulo 109+910^9+9. For example, if the given list is [1,2,3], the final result is 1+2+3=61+2+3=6.

inputFormat

The input begins with an integer TT, the number of test cases. For each test case, the first line contains an integer NN. The second line contains NN space-separated integers.

outputFormat

For each test case, output a single line containing the final sum of the integers modulo 109+910^9+9.## sample

1
3
1 2 3
6

</p>