Dereck is currently taking an online summer school course, but he has one big problem: he is an avid procrastinator who consistently submits all of his work exactly 0 seconds before it's due.
Being the good friend you are, can you help Dereck by telling him when he should be starting his work?
- assignments to do, due at the same time
- The number of hours, , it takes to complete each assignment
- And how many times, , he has to do each assignment (He does assignments multiple times to procrastinate on doing other assignments)
How many hours before the due date should Dereck start his homework and assignments?
The first line will contain one integer, .
The following lines will each contain two integers, and .
Output the number of hours before the due date that Dereck should be starting his work.
5 1 2 3 1 4 4 3 1 5 3
If Dereck starts 39 hours before the due date, he should finish exactly 0 seconds before it's due.