AQT has two multisets of integers
Constraints
In all subtasks,
Subtask 1 [5%]
Subtask 2 [15%]
Subtask 3 [80%]
No additional constraints.
Input Specification
The first line contains one integer
The second line contains
The third line contains
Output Specification
Output the smallest possible value of -1
on a single line.
Sample Input 1
Copy
3
84 80 88 84 93 84 86
5 1 12 7 9 5 5
Sample Output 1
Copy
81
Explanation of Sample Output 1
The smallest possible solution is
Sample Input 2
Copy
1
3 1 9
1 12 123
Sample Output 2
Copy
-1
Comments