I - Array Negations Gym - 102152I

You are given an array aa of nn integers, and an integer kk. You have to make kknegation operations such that at each operation you need to choose an element aiaifrom the array and replace it with −ai−ai.

Your task is to find the optimal way to make the kk negation operations such that at the end the sum of the array aa is as maximal as possible. Can you?

Input

The first line contains an integer TT (1≤T≤1001≤T≤100) specifying the number of test cases.

The first line of each test case contains two integers nn and kk (1≤n≤1041≤n≤104, 0≤k≤1040≤k≤104), in which nn is the size of the array, and kk is the number of negation operations to be made.

Then a line follows contains nn integers a1,⋯,ana1,⋯,an (−100≤ai≤100−100≤ai≤100), giving the array aa.

Output

For each test case, print a single line containing the maximum sum of array aa after making the required number of negation operations.

Example

Input

3
3 1
4 6 2
4 2
-1 0 2 1
5 2
1 7 -4 2 -3

Output

8
4
17

Note

In the first test case, the optimal way is to make the negation operation on a3a3. After this, the array will be = [4,6,−2][4,6,−2], and its sum is 88.

#include
#include
#include
using namespace std;
int a[10010];
int main()
{
	int T;
	scanf("%d",&T); 
	while(T--)
	{
		int n,k;
		scanf("%d%d",&n,&k);
		memset(a,0,sizeof(a));
		for(int i=0;i=k)
		{
			for(int i=0;i

 

你可能感兴趣的:(数论)