시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB111494142.268%

문제

There are $N$ boxes and $N$ coins on the coordinate line. The coordinate of the $i$-th box is $B_i$, and the coordinate of the $j$-th coin is $C_j$. You are starting at the point with coordinate $0$, and can move freely along the coordinate line.

If you go to a point with a coin, you can pick up that coin. You can carry as many coins as you like. If you go to a point with the box, you can utilize one coin and open the box (but you are not forced to do that). You cannot pick up the coin that was already picked up, or open the box that is already opened.

You want to open all $N$ boxes. Find the minimum distance you need to travel to achieve your goal.

입력

The first line of input contains one integer $N$ ($1 \le N \le 10^5$).

The second line contains $N$ integers $B_1, B_2, \ldots, B_N$. The $i$-th of those integers is coordinate of the $i$-th box ($1 \le B_i \le 10^9$, $B_i < B_{i+1}$ for $1 \le i < N$).

The third line contains $N$ integers $C_1, C_2, \ldots, C_N$. The $i$-th of those integers is coordinate of the $i$-th coin ($1 \le C_i \le 10^9$, $C_i < C_{i+1}$ for $1 \le i < N$).

출력

Print one integer: the minimum distance you need to travel to open all boxes.

예제 입력 1

4
1 6 7 12
3 5 10 11

예제 출력 1

21

예제 입력 2

2
1 2
1 1000000000

예제 출력 2

1999999998