G. Easy MIX
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Given an array $$$a$$$ of length $$$n$$$ and constants $$$A$$$, $$$B$$$, $$$C$$$, $$$D$$$.

Let's define the $$$mix$$$ value of an array $$$b_1, b_2, \ldots, b_k$$$ as $$$A \cdot \max(b) + B \cdot \min(b) + C \cdot \text{mex}(b) + D$$$, where:

  • max(b) - the value of the maximum element in $$$b$$$,
  • min(b) - the value of the minimum element in $$$b$$$,
  • mex(b) - the minimum non-negative integer not present in $$$b$$$.

Let's define the $$$mix$$$ value of splitting an array into blocks as the sum of the $$$mix$$$ values of the blocks.

Find the maximum possible $$$mix$$$ value of splitting.

Input

The first line contains one integer $$$T$$$ — the number of test cases.

The first line of each test case contains one integer $$$n$$$ $$$(1 \le n \le 2 \times 10^5)$$$ — length of the array.

The second line contains four integers $$$A, B, C, D$$$ $$$(-10^5 \le A, B, C, D \le 10^5)$$$ — constants for $$$mix$$$ value.

The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ $$$(0 \le a_i \le n)$$$ — elements of the array.

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \times 10^5$$$.

Output

For each test case, output the maximum possible $$$mix$$$ value of splitting.

Example
Input
4
10
-1 0 -1 1
2 4 2 3 0 0 0 1 7 3
10
1 1 0 -1
6 0 1 1 5 1 1 6 2 1
10
0 -2 -3 1
6 3 0 1 4 0 6 9 7 3
10
1 1 -1 0
2 4 3 2 1 6 4 0 1 0
Output
-9
38
-5
44
Note

Splitting of an array is dividing an array into some number of blocks. Every element in the array should be included in exactly one block. Each block should be a contiguous subarray. For example, $$$[1, 2], [3], [4, 5]$$$ is a splitting of the array $$$[1, 2, 3, 4, 5]$$$, and $$$[1, 2], [2]$$$ is not a splitting of the array $$$[2, 2, 1]$$$.