You are given a integer sequence (a1, a2, ..., an) of length n.
In this problem, you need to answer q quiries, each query is of the form:
Meaning you need to answer the sum of al * 1 + al+1 * 2 + al+2 * 3 + ... + ar-1 * (r - l) + ar * (r - l + 1).
The first line contains an integer n: the length of the sequence.
The second line contains n integers a1, a2, ..., an, each integer is seperated by a blank.
The third line contains an integer q: the number of queries you need to answer.
For the next q line, each line contains two integer l r, seperated by a blank.
For each query, print the answer in one line.
For the first query in the sample input, the answer should be a1 * 1 + a2 * 2 + a3 * 3 = 1 * 1 + 1 * 2 + 4 * 3 = 15. For the second query, the answer should be a5 * 1 + a6 * 2 = 1 * 1 + 2 * 4 = 9.