Maximum Subarray
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
You are given an array , consisting of integers. You are also given two integers and .
You have to perform the following operation exactly once: add to the elements on exactly distinct positions, and subtract from all the others.
For example, if , , , and we have picked the first element, then after the operation the array .
Let be the maximum possible sum of a subarray of . The subarray of is a contiguous part of the array , i. e. the array for some . An empty subarray should also be considered, it has sum .
Let the array be the array after applying the aforementioned operation. Apply the operation in such a way that is the maximum possible, and print the maximum possible value of .
The first line contains a single integer () — the number of test cases.
The first line of each test case contains three integers , and (; ; ).
The second line contains integers ().
The sum of over all test cases doesn't exceed .
For each test case, print one integer — the maximum possible value of .
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains three integers , and (; ; ).
The second line contains integers ().
The sum of over all test cases doesn't exceed .
Output
For each test case, print one integer — the maximum possible value of .