Alice and Bob are playing a two player game. Initially, there are n integer numbers in an array and Alice and Bob take turns alternatively. Each player can take one or more numbers from the left-end or the right-end of the array but cannot take from both ends in one turn. A player can take as many consecutive numbers as he/she wants during the turn. The game ends when all numbers are taken from the array.
The point of each player is calculated by the summation of the numbers the player has taken. Each player tries to achieve as much points as possible. If both Alice and Bob play optimally and Alice starts the game, how much more point can Alice get than Bob?
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case contains a blank line and an integer N (1 ≤ N ≤ 100) denoting the size of the array. The next line contains N space separated integers. You may assume that no number will contain more than 4 digits.
Output
For each test case, print the case number and the maximum difference Alice will be able to make after playing this game optimally.
Sample
Sample Input | Sample Output |
---|---|
2 4 4 -10 -20 7 4 1 2 3 4 | Case 1: 7 Case 2: 10 |