Problem Description

Read n integers and q queries l r (1-based). Output sum of each range.

Input Format

First line n q. Second line n integers. Next q lines l r.

Output Format

q lines sums.

Sample Test Case

Input:
5 3 1 2 3 4 5 1 3 2 4 4 5
Output:
6 9 9

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next