CF2218B.The 67th 6-7 Integer Problem

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

The 67th 6-7 Integer Problem

So, Macaque has passed his first challenge (and is not acknowledging your help whatsoever). After all, it was only given to him so he could engage in his greatest pleasure — crunching on desiccated freezedried hamburgers and yelling 'trivial' at the screen. However, he has another, much more important task ahead of him, and he has once again enlisted you to help him.

You are given 77 integers a1,a2,,a7a_1, a_2, \ldots, a_7.

You must negate 66 out of the 77 integers (that is, multiply them by 1-1). Over all possible ways to negate 66 out of the 77 integers, find the maximum possible sum of aa.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t67671 \le t \le 6767). The description of the test cases follows.

The first and only line of each test case contains 77 space-separated integers a1,a2,,a7a_1, a_2, \ldots, a_7 (67ai67-67 \le a_i \le 67).

Output

For each test case, output the maximum sum of aa after negating 66 out of the 77 integers, on a new line.

Note

In the first test case, no matter which 66 integers we pick to negate, the maximum sum is 414141414141+41=205-41-41-41-41-41-41+41=-205.

In the second test case, we can negate all integers except a7a_7 to obtain a sum of 6942067+67=15-6-9-4-20-6-7+67=15.

Samples

4
41 41 41 41 41 41 41
6 9 4 20 6 7 67
1 2 3 4 5 6 7
6 7 6 7 6 7 6
-205
15
-14
-31

在线编程 IDE

建议全屏模式获得最佳体验