


Note that the given operation will be performed only 'N'-1 times, where 'N' is the size of the given array.
The first line of the input contains an integer T denoting the number of test cases.
The first line of each test case contains the integer N, denoting the size of the sorted array.
The second line of each test case contains N space-separated integers denoting the array elements.
The only line of output of each test case should contain a single integer which denotes the minimum cost of merging the whole array.
1 <= T <= 50
1 <= N <= 100
1 <= ARR[i] <= 10^6
Time Limit: 1 sec
‘DP[L][R]’ = S('L', ‘R’) + min('DP[L][L]' + ‘DP[L + 1][R]’, ‘DP[L][L + 1]’ + ‘DP[L + 2][R]’, …, ‘DP[L][R – 1]’ + ‘DP[R][R]’)
‘DP[L][R]’ = S('L', ‘R’) + min('DP[L][L]' + ‘DP[L + 1][R]’, ‘DP[L][L + 1]’ + ‘DP[L + 2][R]’, …, ‘DP[L][R – 1]’ + ‘DP[R][R]’)