How to Eat at a Buffet
InterviewTime limit2sMemory limit512 MB
Given a plate area and items with value per area and available area, pick fractions to maximize total value on the plate.
Problem

Some restaurants sell all you can eat buffet lunches and dinners instead of a fixed seated meal. For a hungry student that is usually the better deal. Alice likes buffet meals, but she always worries about how to fill her plate. She values each of the items on the menu differently, and she wants the total value on her plate to be as large as possible, limited by the area of the plate and by how much of each item is available. The items on the menu are easy to divide, so Alice can take an arbitrary fraction of each dish. Help her fill her plate.
Input
The input consists of lines.
- The first line contains the number of different items on the menu.
- The second line contains the area of Alice's plate, an integer in mm.
- Each of the next lines describes one menu item as two integers separated by a space. The first integer is the value of item per mm as perceived by Alice. The second integer is the area , in mm, that item would occupy if Alice moved all of it onto her plate.
Limits
- For every with :
Output
Print a single line with one integer, the maximal value that Alice can fit on her plate. Every area and every unit value is an integer, so this maximum is always an integer.