Mike is in charge of coaching a tennis club, and the mixed doubles tournament against other clubs is soon approaching!
The club contains men and women, and Mike must form pairs; each pair must contain a man and a woman, such that each player is in exactly one pair.
The -th man has a skill level of , and the -th woman has a skill level of . If the -th man and -th woman are paired, then the skill level of the pair is . Mike wants the team to do well as a whole, so he aims to maximise the total skill level of all pairs.
There are minutes before the tournament starts. In each minute, Mike can train exactly one man or woman, increasing their skill level by .
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 space separated integers, , representing the initial skill level of the men.
The next line contains space separated integers, , representing the initial skill level of the women.
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 . It can be shown that this is the maximum possible total skill level.
Comments