#P1984C1. Magnitude (Easy Version)
Magnitude (Easy Version)
Description
The two versions of the problem are different. You may want to read both versions. You can make hacks only if both versions are solved.
You are given an array of length . Start with . Then, for each from to (in increasing order) do exactly one of the following:
- Option : set to .
- Option : set to , where is the absolute value of .
Let the maximum final value of after the procedure described above be equal to . Find .
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each case contains integers , , , , ().
The sum of over all test cases does not exceed .
For each test case, output a single integer — the value of .
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each case contains integers , , , , ().
The sum of over all test cases does not exceed .
Output
For each test case, output a single integer — the value of .
Note
In the first test case, if we set to its absolute value every time we add to it, we end up with . It can be shown that this is the maximum result.
In the second test case, taking the absolute value will never change anything, so we can just sum the array without doing anything to get .
In the third test case, it is optimal to wait until the end to set to its absolute value, resulting in an answer of .