Traditional Game
Many years ago, when Chmyaaax was not yet evil, he loved to play a traditional game from the tribes of the Link-Cut planet system with Anton. The game takes place on a board, where each cell contains a pair of numbers ,all numbers are distinct. There is also a game piece that initially is at position , and a magical balance that initially equals . The players take turns making moves, with Chmyaaax going first.
Suppose the game piece is currently on cell .
On his turn, Chmyaax can move the piece forward by cells, where , subtracting coins from the balance, and changing the position of the piece to .
On his turn, Anton can move the piece backward by cells, where , adding coins to the balance, and changing the position of the piece to , or he can use magic to move the piece to the last cell, adding coins to the balance, and setting the piece to position .
At any point in time, the piece cannot go off the board (i.e.,its position must be greater than and less than ). The game ends when the piece reaches cell . Chmyaaax's goal is to maximize the balance, while Anton's goal is to minimize it. If both players play optimally, what will the balance be at the end of the game? It can be shown that under these conditions, the game will not continue infinitely.
Input
The first line contains one integer — the size of the board on which the game happens.
The second line contains integers .
The third line contains integers .
For each pair of and , such that and it holds , and .
Output
You need to output that value of balance at the end of the game, if both players play optimally.
Examples
Note
In the first test sample, for Chmyaax is optimal to jump from the start to the end decreasing the balance by , achieving the balance . It could be proven that there isn't any strategy for him, with which he can achieve bigger balance.
In the second test sample, Chmyaax can jump to the cell changing balance to , Anton can move the piece to the last cell, adding to the balance making balance equal .
Scoring
( points): ;
( points): , ;
( points): ;
( points): ;
( points): no additional constraints.