Data analyst Shuvo is auditing a company's daily sales figures. First request: total sales between day L and day R. Read N integers, then a range [L,R] (1-indexed, inclusive). Print the sum of a[L..R].
Input
Line1: N. Line2: N integers. Line3: L R.
Output
Sum of the range.
Constraints
1 ≤ L ≤ R ≤ N ≤ 10^5
Sample Input
5 1 2 3 4 5 2 4
Sample Output
9
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.