PivotOJ

Intermill Logistics

시간 제한: 1000ms메모리 제한: 2048MB출처: BAPC 2025BOJ 35212

문제

It is the 25th of September, 1825. Having just completed a record-setting wheat harvest, you wonder what to do with all this wheat. With a stroke of genius, you decide to use all of this wheat to bake your favourite type of cookie: stroopwafels. Of course, all this wheat should be ground to flour first. Because you cannot wait to start baking, you want to do this as fast as possible, so you decide to contact all flour mills in the Netherlands to ask them for help.

For each of these flour mills, you know how fast they can grind wheat to flour and how long it takes for a shipment to travel to and from the mill. You have enough grain ships available that can transport wheat to these mills, and bring the flour back from the mills. Dividing the wheat optimally between these mills, how long does it take until you have received back all the wheat?

As an example, consider the first sample case. To divide the wheat optimally between the three mills, you ship 400400 kilograms to the first, 120120 to the second, and 480480 to the third. The first mill requires 55 hours to grind its wheat, the second requires 11 hour, and the third requires 33 hours. Combined with the shipping time to and from each mill, you receive all wheat back after exactly 1111 hours.

In the second sample case, we send all of the wheat to the first mill. This mill can grind all 100100 kilograms of wheat in 11 hour, which together with the 22 hours for shipping back and forth results in a total of 33 hours. As the shipping for the second mill would already take 44 hours, it is optimal to only use the first mill.

입력

The input consists of:

  • One line with two integers nn and ww (1n1051\leq n\leq 10^5, 1w1091\leq w\leq 10^9), the number of mills and the amount of wheat you have, in kilograms.
  • nn lines, each with two integers pp and tt (1p,t1091\leq p, t\leq 10^9), describing a mill that can process pp kilograms of wheat per hour, located tt hours away.

출력

Output the number of hours until you have received back all the wheat, when dividing the wheat optimally between the mills.

Your answer should have an absolute or relative error of at most 10610^{-6}.

예제

예제 1

입력
3 1000
80 3
120 5
160 4
출력
11

예제 2

입력
2 100
100 1
500 2
출력
3

예제 3

입력
3 7
1 1
1 1
1 1
출력
4.3333333
코드를 제출하려면 로그인하세요.