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

#BS0000393. Hội tụ (Get Together)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Hội tụ (Get Together)

Get Together

Version: Phuoc Hung OJ Extended

PHOJ practice edition. Its constraints, input/output format, examples and judging rules are specified below.

Statement

There are nn people on a number line. Person ii starts at xix_i and has maximum speed viv_i. Each may move left, right, or remain stationary. All start simultaneously. Find the minimum time for everyone to occupy a common point.

Input

The first line contains an integer nn. Each of the next nn lines contains integers xi,vix_i,v_i.

Output

Print the minimum time. Absolute error must not exceed 10−610^{-6}. The output token may contain at most 128 characters; in scientific notation, the explicit exponent must be from -1000 to 1000.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le 20; −107≤xi≤107-10^7\le x_i\le10^7; 1≤vi≤1051\le v_i\le10^5.
  • Subtask 2 (30 points): 1≤n≤10001\le n\le 1000; −107≤xi≤107-10^7\le x_i\le10^7; 1≤vi≤1051\le v_i\le10^5.
  • Subtask 3 (50 points): 1≤n≤100001\le n\le 10000; −107≤xi≤107-10^7\le x_i\le10^7; 1≤vi≤1051\le v_i\le10^5.

New examples

Input

2
0 1
10 1

Output

5

Explanation

The two people start at 0 and 10 with maximum speed 1 each. After 5 time units they can meet at 5. Earlier, their combined travel distance is less than 10, so they cannot meet.

Input

3
0 1
10 2
4 1

Output

3.333333333333333

Explanation

The first two people are 10 units apart, with combined maximum speed 3. They cannot meet before time 10/310/3. At that time they can meet at 10/310/3. The third person starts at 4 and needs to travel only 4−10/3=2/34-10/3=2/3, less than the allowed distance 10/310/3. Thus all three can meet then.

Input

3
-7 1
-7 3
-7 5

Output

0

Explanation

All three people start at −7-7. They already share a position, so the minimum time is zero regardless of speed.