1029: SYH’s Easy Operating Problem
Description
There are n elements in an array a1~an. Now, SYH gives you an easy operation: Choose an element ai (1 < i < n), and redefine it to ai+1+ai-1-ai. You can do the operation as any times as you want. Try to make the sum of the n numbers as small as possible.
Input
The first line conatins an integer T, means the number of test cases. For each test case, the first line contains an integer n. The second line contains n integers a1 to an.
Output
For each test case ouput “Case: #x:s” in a single line. x is the test case number (starting from 1), and s is your minimal possible answer.
Sample Input Copy
2
4
1 2 3 4
3
1 10 2
Sample Output Copy
Case #1: 10
Case #2: -4
HINT
For the first sample, the final array is: 1 2 3 4.
For the second sample, the final array is: 1 -7 2.
1 ≤ T ≤ 10, 2 ≤ n ≤ 104, 0 ≤ |ai| ≤ 109.