Intermill Logistics
문제
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 kilograms to the first, to the second, and to the third. The first mill requires hours to grind its wheat, the second requires hour, and the third requires hours. Combined with the shipping time to and from each mill, you receive all wheat back after exactly hours.
In the second sample case, we send all of the wheat to the first mill. This mill can grind all kilograms of wheat in hour, which together with the hours for shipping back and forth results in a total of hours. As the shipping for the second mill would already take hours, it is optimal to only use the first mill.
입력
The input consists of:
- One line with two integers and (, ), the number of mills and the amount of wheat you have, in kilograms.
- lines, each with two integers and (), describing a mill that can process kilograms of wheat per hour, located 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 .
예제
예제 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