Little Jimmy is learning how to add integers. As in decimal the digits are 0 to 9, it makes a bit hard for him to understand the summation of all pair of digits. Since addition of numbers requires the knowledge of adding digits. So, his mother gave him a software that can convert a decimal integer to its binary and a binary to its corresponding decimal. So, Jimmy's idea is to convert the numbers into binaries, and then he adds them and turns the result back to decimal using the software. It's easy to add in binary, since you only need to know how to add (0, 0), (0, 1), (1, 0), (1, 1). Jimmy doesn't have the idea of carry operation, so he thinks that:
- 1 + 1 = 0
- 1 + 0 = 1
- 0 + 1 = 1
- 0 + 0 = 0
Using these operations, he adds the numbers in binary. So, according to his calculations,
3 (011) + 7 (111) = 4 (100)
Now, you are given an array of n integers, indexed from 0 to n-1, you have to find a subset of the integers in the array such that the summation (according to Jimmy) of all integers in the subset is as large as possible. You only have to report the maximum sum.
Input
Input starts with an integer T (≤ 100), denoting the number of test cases.
Each case starts with a line containing an integer n (1 ≤ n ≤ 100). The next line contains n space separated non-negative integers, denoting the integers of the given array. Each integer fits into a 64 bit signed integer.
Output
For each case, print the case number, the maximum subset sum that can be made using Jimmy's addition.
Sample
Sample Input | Sample Output |
---|---|
2 3 9 11 5 5 4 8 8 4 4 | Case 1: 14 Case 2: 12 |