Given an array you have to find the max sum of i*A[i] where i is the index of the array obtained by rotating the element of the array one by one . Your task is to complete the function max_sum which takes one argument which is the array A [ ] and returns an integer value denoting the required max sum .

Input:
The first line of input is the number of test cases T . Then T test cases follow . The first line of each test case is an integer N denoting the size of the array . Then in the next line are N space separated values of the array A [ ] .

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.