Problem: You are given an array of integers. You are allowed to perform the following operation on it as many times as you want (0 or more times):
- Choose indices , where and replace for all with
Print the maximum sum of all the elements of the final array that you can obtain in such a way.
Input Format: The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains integers () — the elements of array .
It's guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, print the sum of the final array.
Note: In the first test case, it is not possible to achieve a sum by using these operations, therefore the maximum sum is .
In the second test case, it can be shown that the maximum sum achievable is . By using operation we transform the array from into , thus the sum of the final array is .
In the third test case, it can be shown that it is not possible to achieve a sum by using these operations, therefore the maximum sum is .