Welcome to the final game.
Only 2 contestents remain. You and your worst enemy: HenryZ. Together, you play a game involving a wheel.
The wheel is divided into identical sectors, numbered from to in clockwise order. The th sector has a value of , representing its effectiveness on your friend.
Initially, each sector is occupied by a circular pie, with the pie in the th sector having a value of . At the end of a round, each pie moves to the next sector in clockwise order.
During each round, you will pick an unselected sector. If you pick sector , and pie is currently occupying it, your score for that round is . Your total score is the sum of your scores for each round.
A higher score means a greater probability to persuade your friend. Please find the maximum total score you can achieve if you continue until every sector has been picked.
Input Specification
The first line contains the integer .
The next line contains the space-separated integers .
The final line contains the space-separated integers .
Output Specification
Output one line containing the maximum score you can achieve.
Subtasks
Subtask 1 [20%]
Subtask 2 [80%]
Sample Input 1
3
2 -1 1
1 2 3
Sample Output 1
6
Sample Explanation 1
Round : Pick sector giving
Round : Pick sector giving
Round : Pick sector giving
Comments