1262 - LL’s Arithmetic

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 111

Solved: 40

Description
LL’s bored, so he decides to do an interesting arithmetic. Given positive integers s1, s2…sn, he want s calculate

Please help him.
Input
The first line of input contains one integer specifying the number of test cases to follow. Each test case begins with a line containing an integer N, the number of numbers, which is no more than 1000000 and at least 2. The next line contains N numbers, 1 <= si <= 1000.
Output
For each case, output a line containing the required result modulo 1000000007.
sample input
2
3
1 10 100
4
2 4 6 8
sample output
222
48
hint
source
Xiaotu Liangliang
© 2015 HUST ACMICPC TEAM. All Right Reserved.