You brought chocolates to a party where there are adults and kids. You know that an adult will always eat the chocolate fully and a kid will always eat the chocolate partially. For each chocolate, you know how much happiness it brings to one who eats fully or partially. You want to give everyone exactly one chocolate so that the total happiness they get is maximized.
The first line contains one integer - the number of test cases. For each test case, the first line contains 3 integers , , and denoting the number of chocolates, adults, and kids respectively. For the next lines, line contains two integers and , denoting the happiness one gets if he eats the chocolate fully and partially respectively.
,
,
,
,
,
The sum of over all test cases does not exceed
For each test case, output in a line, the maximum sum of happiness they get. See sample for details.
Input | Output |
---|---|
2 2 1 1 30 12 20 1 3 1 1 20 10 12 10 15 15 | 32 35 |