7181: ABC223 —— C - Doukasen
[Creator : ]
Description
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.
Consider igniting this ob
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$
$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).
输出保持 $7$ 位小数点。
输出保持 $7$ 位小数点。
Constraints
$1≤N≤10^5$
$1 \leq A_i,B_i \leq 1000$
All values in input are integers.
$1 \leq A_i,B_i \leq 1000$
All values in input are integers.
Sample 1 Input
3
1 1
2 1
3 1
Sample 1 Output
3.0000000
The two flames will meet at 3 centimeters from the left end of the object.
Sample 2 Input
3
1 3
2 2
3 1
Sample 2 Output
3.8333333
Sample 3 Input
5
3 9
1 2
4 6
1 5
5 3
Sample 3 Output
8.9166667