Sum Of Elements Between K1th And K2th Smallest Elements

easy
1. Given an array of positive integers and two positive integers K1 and K2. 2. Find sum of all elements greater tha K1th and smaller than K2th smallest elements of array.

Input Format

First line contains N(size of the array). Second line contains N space seperated integers of the array. Third line contains two space seperated integers denoting K1th and K2th smallest elements.

Output Format

Return the integer.

Constraints

1 <= N <= 10^7
 1 <= K1, K2 <= 10^7

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
7
20 8 22 4 12 10 14
3 6
Output
26
Previous
Sum Indexes
Next
Sum Of Given Function Over All Pairs In An Array

Related Questions