PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000115. Cuộc đua điểm số (Pursuit)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Cuộc đua điểm số (Pursuit)

Pursuit

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

You and Ilya have completed nn rounds, each scoring from 00 to 100100. With qq rounds in total, the final score sums the top q−⌊q/4⌋q-\lfloor q/4\rfloor round scores. You may add rounds, in which you could score 100100 and Ilya 00. Find the minimum additional rounds for your total to be at least Ilya's.

Input

Line 1 contains nn. Line 2 contains your nn scores aia_i. Line 3 contains Ilya's nn scores bib_i.

Output

Print the fewest extra rounds required, possibly zero.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le 12; 0≤ai,bi≤1000\le a_i,b_i\le100 for every ii.
  • Subtask 2 (30 points): 1≤n≤25001\le n\le 2500; 0≤ai,bi≤1000\le a_i,b_i\le100 for every ii.
  • Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000; 0≤ai,bi≤1000\le a_i,b_i\le100 for every ii.

Examples

Input

1
0
100

Output

1

Explanation

Initially you have 00 versus Ilya's 100100. Adding one round with scores 100100 versus 00 makes both total scores 100100; therefore one additional round suffices.