Preparando MOJI
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times:
Help William find the maximal sum of array elements, which he can get by performing the sequence of operations described above.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows.
The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array.
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i < 16)$$$, the contents of William's array.
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
5 3 6 4 2 5 1 2 3 4 5 1 10 3 2 3 4 15 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
50 46 10 26 35184372088846
In the first example test case the optimal sequence would be:
The final answer $$$48 + 1 + 1 = 50$$$.
In the third example test case there is no way to change the sum of elements, so the answer is $$$10$$$.