Little Subarray Sum

Tough Dash, February 2019...
Limits 1s, 512 MB

Given an array of N numbers and two indices, determine the sum of the numbers in the array between (and including) those two indices.

Take this array for example:

13 7 20 1 8

The sum of the numbers between and including the indices 1 and 4 is:

7 + 20 + 1 + 8 = 36

Input

The first line of the input will contain three integers N, A, B (0 < N < 100, 0 ≤ A < B < N). A and B are the two indices.

The following line will contain N integers, each between 1 and 1000.

Output

Print the sum of the subarray.

Sample

InputOutput
5 1 4
13 7 20 1 8 
36

Submit

Login to submit.

Contributors

Statistics

98% Solution Ratio
ikaadilEarliest, Feb '19
ikaadilFastest, 0.0s
N550999.Lightest, 0 B
saitotaShortest, 44B
Toph uses cookies. By continuing you agree to our Cookie Policy.