Problem Description
We call a sequence to be binary sequence, if each its element is or .
There are conditions. The -th condition is described by three integers , , and .
Consider the first elements of the sequence. This condition is satisfied if exactly of them are equal to . If it is satisfied, it adds to the total score.
For given integers and , define as the maximum total score among all binary sequences of size that has at most elements equal to and at most elements equal to .
Compute
Input Format
The first line contains two integers and .
The second line contains integers .
The third line contains integers .
The fourth line contains integers .
Output Format
Print one integer: the value
Examples
Example 1
Input
2 5 5 3 2 5 5 2 2 2 1 0 1 8 10 5 6 6 5 5 5 4 5 4 1 4 3 1 0 0 4 9 8 9 7
Output
344 415