410134: GYM103960 N Numbers on both Sides

Memory Limit:1024 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

N. Numbers on both Sidestime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard output

You have just won a deck of cards with $$$N$$$ cards. Each of these cards has two numbers written on it: one on the front side, and another on the back side.

Your friend has challenged you to a game. He shuffled the cards and put them on a table. The cards are laid out on a line, side by side, with the front side facing up.

From left to right, you know that the number written on the front side of the $$$i$$$-th card is $$$A_i$$$, and that the number written on the back side of the $$$i$$$-th card is $$$B_i$$$.

The game is divided into two parts.

In the first part you should pick $$$K$$$ cards of the deck. To pick a card, you have to choose either the first card on the left, or the first card on the right of the table, and take it for you.

After that, you have to choose $$$L$$$ of the cards you picked up and flip them.

Your score will be equal to the sum of the numbers written on the front side of all of the $$$K$$$ cards you picked, plus the sum of the numbers written on the back side of the $$$L$$$ cards you flipped.

The goal? To achieve the highest possible score, of course!

Input

The first line contains an integer $$$N (1 \le N \le 10^5)$$$. The second line contains $$$N$$$ integers $$$A_1$$$, $$$A_2$$$, $$$\dots$$$, $$$A_N$$$, $$$(1 \le A_i \le 10^9)$$$. The third line contains $$$N$$$ integers $$$B_1$$$, $$$B_2$$$, $$$\dots$$$, $$$B_N$$$, $$$(1 \le B_i \le 10^9)$$$. The fourth line contains two integers $$$K$$$ and $$$L$$$ ($$$1 \le L \le K \le N$$$).

Output

Print one line containing an integer, representing the highest score possible.

ExamplesInput
5
9 7 2 2 9
5 2 2 3 1
2 1
Output
23
Input
5
9 7 2 2 9
5 9 2 3 1
2 1
Output
25

加入题单

上一题 下一题 算法标签: