Given a sequence of numbers a_1, \ldots, a_n. For given indices and , calculate
The first line contains the number of elements (1 \le n \le 10^6). The second line contains the numbers a_i (1 \le a_i \le 1000) separated by spaces. The third line contains the number of queries (1 \le m \le 10^6). Each of the next lines contains the indices l_i and r_i (1 \le l_i \le r_i \le n).
Print the value S_{l_i, r_i} for each query on a separate line.
Example 1