Mike is in charge of coaching a tennis club, and the mixed doubles tournament against other clubs is soon approaching!
The club contains
The
There are
What is the maximum possible sum of the skill level of all pairs once the tournament starts? Because the answer may be very large, output the answer modulo
Constraints
Subtask 1 [10%]
Subtask 2 [40%]
Subtask 3 [50%]
No additional constraints.
Input Specification
The first line contains two space separated integers
The next line contains
The next line contains
Output Specification
On a single line, print the maximum possible sum of the skill levels of all pairs, modulo
Sample Input
3 2
4 7 6
2 5 6
Sample Output
94
Explanation
In the first minute, Mike can increase the skill level of the second man.
In the second minute, Mike can increase the skill level of the third woman.
Mike can then pair the first man and the first woman, the second man and the third woman, as well as the third man and the second woman.
The total sum of skill levels of all pairs would be
Comments