The first line contains the length of the sequence N (1≤N≤100000).
The second line contains A1,A2,…,AN separated by spaces. (1≤Ai≤100000)
The third line contains the number of queries M (1≤M≤100000).
Each of the next M lines contains one query i, j. (1≤i≤j≤N)