Score : $500$ points
$10^{100}$ potatoes are coming from a conveyor belt one by one. The weights of the potatoes are described by a sequence $W = (W_0, \dots, W_{N-1})$ of length $N$: the weight of the $i$-th potato coming is $W_{(i-1) \bmod N}$, where $(i-1) \bmod N$ denotes the remainder when $i - 1$ is divided by $N$.
Takahashi will prepare an empty box and then pack the potatoes in order, as follows.
You are given $Q$ queries. In the $i$-th query $(1 \leq i \leq Q)$, given a positive integer $K_i$, find the number of potatoes in the $K_i$-th box to be sealed. It can be proved that, under the Constraints of the problem, there will be at least $K_i$ sealed boxes.
Input is given from Standard Input in the following format:
$N$ $Q$ $X$ $W_0$ $W_1$ $\ldots$ $W_{N-1}$ $K_1$ $\vdots$ $K_Q$
Print $Q$ lines. The $i$-th line $(1 \leq i \leq Q)$ should contain the answer to the $i$-th query.
3 2 5 3 4 1 1 2
2 3
Before sealing the $2$-nd box, Takahashi will do the following:
The $1$-st box sealed contains $2$ potatoes, and the $2$-nd box sealed contains $3$ potatoes.
10 5 20 5 8 5 9 8 7 4 4 8 2 1 1000 1000000 1000000000 1000000000000
4 5 5 5 5