The Byteotian War

No attempts yetTime limit1sMemory limit128 MB

Problem

Jaś and Staś play a card game called the Byteotian War. At the start of the game each player receives a deck of nn cards. Every card has a single integer written on it.

The game is played in turns. On each turn every player takes the top two cards of their own deck and chooses one to discard and the other to hand to the opponent. On every turn exactly one card is discarded and exactly one is handed over. The opponent places the received card at the bottom of their own deck.

The game ends once both players are left with a single card. If the number on Jaś's card is jj and the number on Staś's card is ss, then Jaś earns jsj - s points and Staś earns sjs - j points.

Assume both players play optimally, each maximizing their own score computed by the rule above. How many points does Jaś earn?

Input

The first line contains a single integer nn (1n1061 \le n \le 10^6), the number of cards each player receives. The second line contains nn integers aia_i (1ai1061 \le a_i \le 10^6) describing Jaś's deck from the top card down. The third line describes Staś's deck in the same format.

Output

Print a single integer, the number of points Jaś earns when both players play optimally.