Given an array of integers of size **N** and a number **K**. Your must modify array K number of times. Here modify array means in each operation you can replace any array element either **arr[i] by -arr[i]** or **-arr[i] by arr[i]**. You need to perform this operation in such a way that after K operations, sum of array must be maximum.

**Input:**

The first line of input contains an integer **T** denoting the number of test cases. Then T test cases follow. Each test case consist of two lines . The first line of each test case contains an integer N and K. The second line of each test case contains N space separated integers denoting elements of the array.

**Output:**

For each test case, print maximum possible sum.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ N ≤ 10^{7}

-10^{18} ≤ A_{i} ≤ 10^{18}

**Example:**

**Input:**

2

5 1

1 2 -3 4 5

10 5

5 -2 5 -4 5 -12 5 5 5 20

**Output:**

15

68

**Explanation:
Testcase 1: **In testcase 1 we have k=1 so we can change -3 to 3 and sum all the elements to produce 15 as output.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

makeitdonesolo | 64 |

ShubhamJain18 | 64 |

Bishnu Dev Panda | 54 |

DanishBansal | 50 |

abhithakur588 | 50 |

Bishnu Dev Panda | 777 |

yk12 | 512 |

okayboss | 490 |

DevMittal | 472 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.