Given a sequence A of length n.
There are m queries, each given l, r, let B1,B2,…,Br−l+1 as the result of sorting A_rAl,Al+1,…,Ar, calculate:
The second line contains n integers A1,A2,…,An (1≤Ai≤10^9).
Each of the following m lines contains two
integers l,
r (1≤l≤r≤n).
6 5
8 2 5 9 7 7
1 4
2 6
1 3
3 6
2 5
588255953
426219106
12500000
575819351
16793812