You are given an array aa of nn integers a1,a2,a3,…,an.
You have to answer qq independent queries, each consisting of two integers ll and rr.
Consider the subarray a[l:r]a[l:r] [al,al1,…,ar][al,al1,…,ar]. You can apply the following operation to the …