Limits 1s, 512 MB

A robber attempted to rob TS(Taka Sesh) Bank but failed to complete the task. However, he managed to open all the vaults successfully.

Bob is a scientist in a tech giant company specializing in developing AI-based robots. His work has earned him considerable fame in his field. Interestingly, Bob is also a client of TS Bank (Taka Sesh Bank), and like many others, he is also greedy for money. Taking advantage of the failed robbery, Bob decides to steal money from the vaults, sending an AI-based robot named ‘Alpha’ to TS bank to steal that money.

There are nn vaults arranged in a line left to right, where the ith(1in)i^{th} \: (1 \le i \le n) vault has xix_i money in it.

There are two security guards, one of them guards the bthb^{th} vault, and the other one guards the cthc^{th} vault. The two guards have strict instructions not to leave their guarding posts.

Alpha can go only left or right. Alpha won’t visit a vault more than once. Whenever Alpha is in a vault, he will steal all the money in that vault.

Alpha starts stealing from the atha^{th} vault. Alpha is at a disadvantage that the atha^{th} vault is one of the vaults which are between the bthb^{th} and the cthc^{th} vault. Meaning Alpha has a guard in one of the vaults left of him and the other one guarding one of the vaults right of him, meaning b<a<cb<a<c.

Note that Alpha cannot steal from a guarded vault. So, Alpha stops stealing and escapes the bank if it encounters a guard.

Now you have to print what is the maximum amount of money Alpha can steal from the TS Bank.

Input

The first line of input will contain four integers n,a,b,c(3n105;1b<a<cn)n, a, b, c \: (3\le n \le 10^5; \: 1 \le b < a < c \le n), separated by spaces — denoting the number of vaults and the positions of Alpha, the first security guard, and the second security guard, respectively.

The next line of input contains nn space separated integers x1,x2,...,xn(0xi103)x_1, x_2,..., x_n \: (0 \le x_i \le 10^3), denoting that the ithi^{th} vault has xix_i amount of money.

Output

Output a single integer — denoting the maximum amount that Bob can steal from the bank.

Check out the samples for clarification.

Sample

InputOutput
5 3 1 5
9 2 1 5 3
6

Explanation:

If Alpha moves to the left, it can steal from the 2nd2^{nd} and 3rd3^{rd} vaults, resulting in a total of 33.

On the other hand, if it moves to the right, it can steal from the 3rd3^{rd} and 4th4^{th} vaults, resulting in a total of 66. Here, Alpha cannot steal from the 2nd2^{nd} vault because he has already visited 3rd3^{rd} vault, to steal from the 2nd2^{nd} vault he has to go through 3rd3^{rd} which he can’t. So, final value is 66.


Submit

Login to submit.

Statistics

86% Solution Ratio
iffatul_anonEarliest, 11M ago
IU_SpiralForgeFastest, 0.0s
iffatul_anonLightest, 4.9 MB
Nusab19Shortest, 110B
Toph uses cookies. By continuing you agree to our Cookie Policy.