Cute Panda

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

There are nn pandas numbered from 11 to nn, ii-th of them has a_ia\_i donuts. There are also nn bins numbered from 11 to nn, ii-th of them can hold b_ib\_i donuts. For any ii from 11 to nn, ii-th panda can distribute his donuts to ii-th and (imodn+1)(i \bmod n + 1)-th bin.

Can you find a way to maximize the number of distributed donuts?

입력

The input contains zero or more test cases, and is terminated by end-of-file. For each test case:

The first line contains an integer nn (3n1063 \leq n \leq 10^6).

The second line contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (0a_i1090 \leq a\_i \leq 10^9).

The third line contains nn integers b_1,b_2,,b_nb\_1, b\_2, \ldots, b\_n (0b_i1090 \leq b\_i \leq 10^9).

It is guaranteed that the sum of all nn does not exceed 10610^6.

출력

For each test case, output an integer which denotes the maximum number of distributed donuts.