{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"Given $n$ positive integers forming a sequence $a_1, a_2, \\cdots, a_n$ and $m$ intervals $[l_i,r_i]$, find the sum of these $m$ intervals.\n\nFor all test data, $n,m\\le10^5,a_i\\le 10^4$"}},{"title":"Input","value":{"format":"MD","content":"The first line contains a positive integer $n$.\n\nThe second line contains $n$ positive integers $a_1,a_2, \\cdots ,a_n$.\n\nThe third line contains a positive integer $m$.\n\nThe next $m$ lines each contain two positive integers $l_i,r_i$, satisfying $1\\le l_i\\le r_i\\le n$."}},{"title":"Output","value":{"format":"MD","content":"There are $m$ lines in total.\n\nThe $i$-th line represents the result for the $i$-th query."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\n4 3 2 1\n2\n1 4\n2 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\n5\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"Explanation for the sample: The sum of the numbers from the $1$-th to the $4$-th is $10$. The sum of the numbers from the $2$-th to the $3$-th is $5$.\n\nFor the $50 \\%$ data: $n,m\\le 1000$;\n\nFor the $100 \\%$ data: $1 \\le n, m\\le 10^5$, $1 \\le a_i\\le 10^4$"}}]}