P16849 [HackerEarth] It is 14^th of Feb, Chotu has worked really hard for the past seven days to impress his crush. Now it's time to take her on a perfect date. He has planned to take his girl to LoveLand. L
普及-
题目描述

It is 14^th of Feb, Chotu has worked really hard for the past seven days to impress his crush. Now it's time to take her on a perfect date. He has planned to take his girl to LoveLand. LoveLand is a mystical place built only for new lovers. LoveLand is a one dimensional world of N blocks numbered from 1 to N, the i^th block has a fare Ai that the couple has to pay for visiting the block.

Chotu being a student has limited pocket-money left for the date. In this hard time he is asking for your help. Don't worry, you don't have to lend him money instead he will ask you certain question to verify if he has enough money for the date. Each query comprises of two integers L and R, denoting two block numbers in the LoveLand. You have to tell Chotu what is the total cost of visiting the blocks [L, L + 1, L+2,....R] (both inclusive).

Chotu is pretty impatient for the date, so you have to be really quick in answering all his queries.
Input

First line contains integer N and Q denoting number of blocks and the number of queries respectively.
Next line contains N integers denoting the fare of visiting each block.
Q lines follow each with two integers L and R.
Ouptut

For each query print the required answer.
Constraints

1 ≤ N ≤ 10^5

0 ≤ Ai ≤ 10^4

1 ≤ Q ≤ 10^5

1 ≤ L ≤ R ≤ N

SAMPLE INPUT
7 4
1 2 3 4 5 6 7
1 1
2 5
1 7
4 6

SAMPLE OUTPUT
1
14
28
15

输入格式

见题面

输出格式

见题面

样例输入
100 100 497 6256 3118 5546 7197 4704 5530 4871 6657 4558 1103 9395 2405 4509 1280 742 3383 5172 7624 9992 5458 165 305 3732 9673 9054 1273 6121 8665 7943 2079 7559 5182 7803 6424 1618 9002 5263 4393 203 1721 8298 3149 4551 1244 3015 3824 7149 3967 1218 1243 4093 6253 5168 540 204 435 1106 2158 3426 3348 2686 6958 6174 31 2433 1858 341 2969 694 90 6633 2926 201 4778 5561 5541 8460 755 6496 2531 3559 2101 6001 605 4102 6227 5810 7328 9067 4551 8525 7296 1714 6574 978 5504 3140 3751 9689 70 90 17 61 9 25 58 75 81 99 33 40 11 80 68 68 20 85 17 87 49 76 44 62 54 57 8 15 15 36 47 59 15 39 49 83 85 90 6 27 31 60 62 73 22 62 91 94 1 41 36 58 81 96 47 94 17 35 18 92 31 98 27 67 26 84 13 36 18 99 22 43 69 84 24 70 31 71 7 72 20 21 37 59 68 90 43 47 16 32 66 69 33 50 22 98 53 56 29 53 2 6 57 99 33 70 44 56 9 44 17 95 18 62 31 74 46 80 12 56 46 49 6 39 60 74 71 90 24 63 56 70 10 33 42 93 37 90 20 84 8 24 21 87 67 79 64 84 40 84 45 72 13 88 9 21 50 67 12 50 57 99 71 73 36 44 38 92 14 48 4 17 63 93 3 34 44 74 41 75 30 82 53 69 48 53 13 95 8 18 15 23 31 60 19 76 19 67 36 73
样例输出
389976 125377 167485 221737 164806 116463 201012 350330 331874 115055 37254 17023 80671 75255 141868 76848 186764 92643 194108 39820 145603 334406 323417 48258 320697 74219 51308 204831 173788 97701 4304 209883 138159 324902 168180 113884 10870 315467 99039 230811 363093 140683 141763 298949 46967 61519 372222 14663 124511 55520