This is a little console mode utility program which is able to
(de-)compress SINGLE files with a static Arithmetic compression
algorithm. You could easily add the RLE/BWT/MFT data
transformation algorithms. Just rip the corresponding classes
out of my HuffComp source code. I won t add these ones in the
next time.
Input
The first line of the input contains a SINGLE integer T (1 <= T <= 20), the number of test cases. Then T cases follow. The first line of each case contains N, and the second line contains N integers giving the time for each people to cross the river. Each case is preceded by a blank line. There won t be more than 1000 people and nobody takes more than 100 seconds to cross.
Output
For each test case, print a line containing the total number of seconds required for all the N people to cross the river.
Sample Input
1
4
1 2 5 10
Sample Output
17