Oscar is playing games throughout an entire course! In this course, there are friends, and snitches. Each friend will cover Oscar for a number of lessons, from to , inclusive. Each snitch will also be next to Oscar for a number of lessons, from to , inclusive. Oscar is only able to play games during lessons when there are strictly more friends covering him than snitches.
Given that there are lessons in this course, and queries, can you figure out at what point in time Oscar will game for lessons for each query? If he will never reach this many lessons, print .
Input Specification
The first line will contain , , , and , the number of friends, snitches, lessons in the course, and queries respectively.
The next lines will contain integers and , the lessons where Oscar is covered for.
The next lines will contain integers and , the lessons where a snitch will be next to Oscar.
The next lines will contain integer , the query that Oscar wants you to figure out.
Output Specification
For each query, output the earliest point in time Oscar will have gamed for lessons in total, or if he can't achieve this.
Subtask 1 [30%]
Subtask 2 [70%]
No further constraints.
Sample Input 1
4 2 10 4
1 3
3 6
4 4
9 10
2 8
2 4
1
2
3
4
Sample Output 1
1
9
10
-1
Sample Explanation
Oscar can only play games during the st, th and th lessons. Since he will never game for lessons in total, the answer is .
Comments