Woburn Challenge 2016-17 Round 1 - Senior Division

Oh boy! It's Tricky's favourite time of year, Halloween! He can't wait to put on his awesome dinosaur costume and take a walk around his neighbourhood. Of course, what he's looking forward to the most are the loads of treats his neighbours are sure to give him!
Tricky lives at one end of a long street. There are
Tricky would love to get as many treats as possible, but one thing may
stand in his way - time! He absolutely must be home no later than
midnight (that's when the real monsters come out). Fortunately, he may
be getting quite a head start on his trick-or-treating expedition -
he'll be leaving home
Despite his elaborate costume and the potential weight of many treats,
Tricky can get around pretty quickly. He can walk down the street in
either direction at a rate of 1 metre per millisecond. If he decides to
stop at a house along the way to collect its treats, it'll take him
Given that Tricky must be back in the safety of his house at the end of
the street after no more than
In test cases worth
In test cases worth another
In test cases worth another
Input Specification
The first line of input consists of three space-separated integers
Output Specification
Output one line consisting of a single integer - the maximum number of treats that you can receive while still returning home by midnight.
Sample Input
4 2000 500
123 4
400 20
100 5
751 999
Sample Output
25
Sample Explanation
One optimal strategy is for Tricky to walk to the
Comments
1000 milliseconds * 1 meter per millisecond = 1000 metres per second. Is bro The Flash or something