#BS0000007. Những con sâu (Worms)
Những con sâu (Worms)
Worms
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are ordered piles of worms. Pile contains worms. All worms are labeled consecutively across the piles, starting from label .
For each queried label , determine which pile contains that worm.
Input
The first line contains .
The second line contains .
The third line contains .
The fourth line contains .
Output
For each query, print the 1-based pile number containing the queried label.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , , , .
Examples
Input
5
2 7 3 4 9
3
1 25 11
Output
1
5
3
Explanation
The pile-ending prefix sums are . Label is greater than and at most , so it belongs to pile .