Problem: Timur is in a car traveling on the number line from point to point . The car starts moving from point at minute .
There are signs on the line at points , and Timur knows that the car will arrive there at minutes , respectively. The sequences and are strictly increasing with .
Between any two adjacent signs, the car travels with a constant speed. Timur has queries: each query will be an integer , and Timur wants you to output how many minutes it takes the car to reach point , rounded down to the nearest integer.
Input Format: The first line contains a single integer () — the number of test cases.
The first line of each test case contains three integers , , and , (; ) — the final destination, the number of points Timur knows the time for, and the number of queries respectively.
The second line of each test case contains integers (; for every ; ).
The third line of each test case contains integers (; for every ).
Each of the following lines contains a single integer () — the distance that Timur asks the minutes passed for.
The sum of over all test cases doesn't exceed , and the sum of over all test cases doesn't exceed .
Output Format: For each query, output a single integer — the number of minutes passed until the car reaches the point , rounded down.
Note: For the first test case, the car goes from point to point in minutes, so the speed is unit per minute and:
- At point , the time will be minutes.
- At point , the time will be minutes.
- At point , the time will be minutes.
For the second test case, between points and , the car travels at a speed of unit per minute and between and with a speed of units per minute and:
- At point , the time will be minutes.
- At point , the time will be minutes.
- At point , the time will be minutes.
- At point , the time will be minutes, so the answer is .
For the fourth test case, the car travels with units per minute, so the answers to the queries are:
- At point , the time will be minutes, so the answer is .
- At point , the time will be minutes.
- At point , the time will be minutes, so the answer is .