Computer Lab

No attempts yetTime limit4sMemory limit512 MB

Problem

The lab at CSHS (Computer Science High School) has MM computers in a row. The computers are numbered 11 to MM from left to right.

NN students are already sitting in the lab, at computers A1A_1, A2A_2, ..., ANA_N. Self study starts soon, so MNM-N more students come in and use one free computer each.

A student dislikes having another student look at their monitor, so each student who comes in takes a seat this way.

  • Choose the run of consecutive computers with no student that holds the most computers. If there are several such runs, choose the leftmost one.
  • Sit at the computer in the exact middle of the chosen run. If the run holds an even number of computers, sit at the left one of the two middle computers.

The students who are already seated entered first. So for iNi \le N, the ii-th student to enter sits at computer AiA_i, and for i>Ni > N, the ii-th student to enter is the (iN)(i-N)-th student who takes a seat by the rule above.

Jinhwan has a team project with QQ friends, so he needs to know where they sit. He knows the position of each friend in the entering order. Help Jinhwan and find the seat of each friend.

Input

The first line contains the number of computers MM, the number of students already seated NN, and the number of friends QQ.

The second line contains NN integers. The ii-th value is the position AiA_i of a seated student. Note that the students already seated may not have taken their seats by the rule above.

The third line contains QQ integers. The ii-th value is BiB_i, the position of the ii-th friend in the order of entering the lab.

AA and BB are ascending. That is, 1A1<A2<<ANM1 \le A_1 < A_2 < \dots < A_N \le M and 1B1<B2<<BQM1 \le B_1 < B_2 < \dots < B_Q \le M always hold.

Output

Print QQ lines. Line ii holds the number of the computer where the ii-th friend sits. The integers involved go past the range of a 32-bit integer, so use a 64-bit integer type.

Limits

  • 1N1051 \le N \le 10^5
  • NM1018N \le M \le 10^{18}
  • 1Qmin(M,105)1 \le Q \le \min(M, 10^5)