Tejas was once playing with an array and he wondered what the maximum subarray sum of this array could be, this problem was too boring, so based on his hate for the number zero because of his recent exam results, he made another related problem -
"What is the maximum possible sum of a subarray of the given array, such that it's bitwise AND is greater than zero"
He gave the problem to you to solve. Write a program to solve it
Input:
The 1st line contains T, the number of test cases
The 1st line of each test case contains N, the size of the array A
The second line of each test case contains N space separated integers, the array A
Output:
Print an integer in each line, the max subarray sum whose Bitwise AND is greater than 0.
Constraints:
1 <= T <= 105
1 <= N <= 105
0 <= Ai < 230
The sum of N over all TC doesn’t exceed 5*105.