Suppose we have an array a whose elements are non-negative integers. We can apply operations of two types to this array:
After any operation, all the elements must remain non-negative.
It is easy to see that we cannot do such operations indefinitely. We'll call a chain of operations maximal if no valid operation can occur after performing this chain of operations.
Now you are given an array b of length n. Your should handle two types of queries:
The first line of input contains one integer n, the length of array b (1≤n≤2⋅105).
The second line contains n integers separated by spaces: the initial elements of array b (0≤b_i≤105).
The third line contains one integer q, the number of queries (1≤q≤2⋅105).
Each of the next q lines contains a query.
For queries of the first type, 1≤p≤n and 0≤x≤105.
For queries of the second type, 1≤l≤r≤n.
For each query of the second type, print the answer on a separate line. Answers should be printed in the same order as queries.