Statement
Statement language
Two positive integer sequences and of length are given. Let be any permutation of , and define .
Build a histogram from unit-width bars of heights in order. Over every possible permutation of , find the maximum possible area of the largest axis-aligned rectangle in the resulting histogram.
Input
The input is given in the following format:
Each case is given in the following format:
Output
For each test case, print the maximum possible area.
Constraints
- ()
- The sum of over all test cases does not exceed .
Subtasks
Samples
Input
1
3
1 2 3
3 1 2
Output
12
With , every bar has height , giving a rectangle of area .