There are N packets of goods each having some number of items in it. The number of items is in the form of an array A (A[i] items of the ith type). There are M number of people in total each having a share in the goods. They have shares in the form of L and R which means that they hold a share of goods [L....R]. You require Q items. You must identify the items one by one.
For each time you take an item, you are required to determine the number of people who have lost all the items from their share.
Note
Input format
Output format
Print Q space-separated integers representing the number of people who lost all the items of their share.
Constraints
1≤N,M,Q≤105
1≤A[i]≤105
1≤L≤R≤N
All Q integers will be in the range of 1 to N.
After 2nd query goods are 2 1 0 0. So pair (3,3) is lost.
After 4th query goods are 1 0 0 0. So pairs (3,3) and (2,3) are lost .
After 5th query goods are 0 0 0 0. So all the 3 pairs are lost.