{"raw_statement":[{"iden":"problem statement","content":"$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$.\nTakahashi will prepare an empty box and then pack the potatoes in order, as follows.\n\n*   Pack the incoming potato into the box. If the total weight of the potatoes in the box is now $X$ or greater, seal that box and prepare a new empty box.\n\nYou 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."},{"iden":"constraints","content":"*   $1 \\leq N, Q \\leq 2 \\times 10^5$\n*   $1 \\leq X \\leq 10^9$\n*   $1 \\leq W_i \\leq 10^9 \\, (0 \\leq i \\leq N - 1)$\n*   $1 \\leq K_i \\leq 10^{12} \\, (1 \\leq i \\leq Q)$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $Q$ $X$\n$W_0$ $W_1$ $\\ldots$ $W_{N-1}$\n$K_1$\n$\\vdots$\n$K_Q$"},{"iden":"sample input 1","content":"3 2 5\n3 4 1\n1\n2"},{"iden":"sample output 1","content":"2\n3\n\nBefore sealing the $2$\\-nd box, Takahashi will do the following:\n\n*   Prepare an empty box.\n*   Pack the $1$\\-st potato into the box. Now, the total weight of potatoes in the box is $3$.\n*   Pack the $2$\\-nd potato into the box. Now, the total weight of potatoes in the box is $3 + 4 = 7$, which is not less than $X = 5$, so seal this box.\n*   Prepare a new empty box.\n*   Pack the $3$\\-rd potato into the box. Now, the total weight of potatoes in the box is $1$.\n*   Pack the $4$\\-th potato into the box. Now, the total weight of potatoes in the box is $1 + 3 = 4$.\n*   Pack the $5$\\-th potato into the box. Now, the total weight of potatoes in the box is $1 + 3 + 4 = 8$, which is not less than $X = 5$, so seal this box.\n\nThe $1$\\-st box sealed contains $2$ potatoes, and the $2$\\-nd box sealed contains $3$ potatoes."},{"iden":"sample input 2","content":"10 5 20\n5 8 5 9 8 7 4 4 8 2\n1\n1000\n1000000\n1000000000\n1000000000000"},{"iden":"sample output 2","content":"4\n5\n5\n5\n5"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}