You are given two multisets and , each containing elements. In one step, you can choose an integer from , delete an occurrence of from , and add either or to . Determine the minimum number of moves required such that the condition satisfies.
Input format
Note: All the numbers are positive integers smaller or equal to .
Output format
Print the remainder of the answer when divided by .
To obtain the optimal answer we need to perform the following operations:
1. Delete and add ,
2. Delete and add ,
3. Delete and add ,
4. Delete and add ,