Problem: You are given an integer array of length .
You can perform the following operation: choose an element of the array and replace it with any of its neighbor's value.
For example, if , you can get one of the arrays , and using one operation, but not ] or .
Your task is to calculate the minimum possible total sum of the array if you can perform the aforementioned operation at most times.
Input Format: The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and (; ).
The second line contains integers ().
Additional constraint on the input: the sum of over all test cases doesn't exceed .
Output Format: For each test case, print a single integer — the minimum possible total sum of the array if you can perform the aforementioned operation at most times.
Note: In the first example, one of the possible sequences of operations is the following: ].
In the second example, you do not need to apply the operation.
In the third example, one of the possible sequences of operations is the following: .
In the fourth example, one of the possible sequences of operations is the following: .