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

#BS0000394. Điểm hẹn không thể thay đổi (The Meeting Place Cannot Be Changed)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Điểm hẹn không thể thay đổi (The Meeting Place Cannot Be Changed)

The Meeting Place Cannot Be Changed

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

On a straight road in Bytecity, nn friends are at coordinates measured in metres from south to north. Friend ii starts at xix_i and can travel in either direction at a speed of at most viv_i metres per second. They wish to gather at a single point, which need not have an integer coordinate. Find the minimum time required.

Input

The first line contains integer nn. The second line contains nn integers x1,…,xnx_1,\ldots,x_n. The third line contains nn integers v1,…,vnv_1,\ldots,v_n.

Output

Print the minimum time in seconds. The absolute or relative error must not exceed 10−610^{-6}.

Subtasks

  • Subtask 1 (20 points): 2≤n≤202\le n\le 20; 1≤xi,vi≤1091\le x_i,v_i\le10^9 for every 1≤i≤n1\le i\le n.
  • Subtask 2 (30 points): 2≤n≤10002\le n\le 1000; 1≤xi,vi≤1091\le x_i,v_i\le10^9 for every 1≤i≤n1\le i\le n.
  • Subtask 3 (50 points): 2≤n≤600002\le n\le 60000; 1≤xi,vi≤1091\le x_i,v_i\le10^9 for every 1≤i≤n1\le i\le n.

Examples

Input

3
7 1 3
1 2 1

Output

2.000000000000

Explanation

After 2 seconds the three friends reach 5 by moving 2 metres south, 4 metres north, and 2 metres north. The first two start 6 metres apart and their combined speed is at most 3, so they cannot meet sooner.

Input

4
5 10 3 2
2 3 2 4

Output

1.400000000000

Explanation

At time 1.4 the reachable intervals are [2.2,7.8][2.2,7.8], [5.8,14.2][5.8,14.2], [0.2,5.8][0.2,5.8], [−3.6,7.6][-3.6,7.6], sharing 5.8. Friends 2 and 3 are 7 metres apart with combined speed 5, requiring at least 1.4 seconds.