Contest Duration: - (local time) (100 minutes) Back to Home
C - Doukasen /

Time Limit: 2 sec / Memory Limit: 1024 MB

### 問題文

N 本の導火線を一直線に接着したものがあります。左から i 本目の導火線は長さが A_i cm で、 1 秒あたり B_i cm の一定の速さで燃えます。

この導火線の左端と右端から同時に火をつけるとき、 2 つの火がぶつかる場所が着火前の導火線の左端から何 cm の地点か求めてください。

### 制約

• 1 \leq N \leq 10^5
• 1 \leq A_i,B_i \leq 1000
• 入力は全て整数

### 入力

N
A_1 B_1
A_2 B_2
\vdots
A_N B_N


### 出力

2 つの火がぶつかる場所が着火前の導火線の左端から何 cm の地点か（単位を除いて）出力せよ。

### 入力例 1

3
1 1
2 1
3 1


### 出力例 1

3.000000000000000


### 入力例 2

3
1 3
2 2
3 1


### 出力例 2

3.833333333333333


### 入力例 3

5
3 9
1 2
4 6
1 5
5 3


### 出力例 3

8.916666666666668


Score : 300 points

### Problem Statement

We have N fuses connected in series. The i-th fuse from the left has a length of A_i centimeters and burns at a constant speed of B_i centimeters per second.

Consider igniting this object from left and right ends simultaneously. Find the distance between the position where the two flames will meet and the left end of the object.

### Constraints

• 1 \leq N \leq 10^5
• 1 \leq A_i,B_i \leq 1000
• All values in input are integers.

### Input

Input is given from Standard Input in the following format:

N
A_1 B_1
A_2 B_2
\vdots
A_N B_N


### Output

Print the distance between the position where the two flames will meet and the left end of the object, in centimeters (print just the number).

Your output will be considered correct when its absolute or relative error from our answer is at most 10^{-5}.

### Sample Input 1

3
1 1
2 1
3 1


### Sample Output 1

3.000000000000000


The two flames will meet at 3 centimeters from the left end of the object.

### Sample Input 2

3
1 3
2 2
3 1


### Sample Output 2

3.833333333333333


### Sample Input 3

5
3 9
1 2
4 6
1 5
5 3


### Sample Output 3

8.916666666666668