#codefestival2015okinawab. [code_festival_2015_okinawa_b]Beware of the Sogginess!
[code_festival_2015_okinawa_b]Beware of the Sogginess!
Problem
Hence Wolf Sothe likes eating Okinawa Soba (a kind of famous food in Okinawa, which is made of noodles and soup), he comes to an Okinawa Soba restaurant today. There are different kinds of Okinawa Soba. At the beginning, the kind of Okinawa Soba consists of grams of noodles and grams of soup.
Noodles will absorb soup after being purchased. Specifically, for the kind of Okinawa Soba, if we had waited for ( is a real number such that ) seconds after the purchase, the weight of the noodles will be grams, the weight of soup will be grams. The waiting time for each kind of Okinawa Soba is independent.
Wolf Sothe will choose a few kinds of Okinawa Soba among the kinds to buy. For each kind of Okinawa Soba, there is only 1 item available.
Wolf Sothe wants to eat or more than grams of noodles and or more than grams of soup in total. Find the best solution that only needs the minimum amount of items of Okinawa Soba.
Please note that it costs no time for Wolf Sothe for eating Okinawa Soba, thus while Wolf Sothe is eating there is no absorption. In the other words, noodles will not absorb soup while Wolf Sothe is eating.
Input
Inputs will be given by standard input in following format.
:
- At the first line, integer , , will be given divided by spaces.
- From the second line there are additional lines, for each line , will be given divided by spaces.
Output
Please output the number of the minimum amount of items of Okinawa Soba that needs to be purchased to let Wolf Sothe to eat or more than grams of noodles and or more than grams of soup.
If there is no solution that meets Wolf Sothe’s need, output -1
.
Print a newline at the end of output.
Input Example 1
3 9 7
3 4
8 1
4 5
Output Example 1
2
Purchase the 1st and the 3rd kind of Okinawa Soba. For the 1st kind of Okinawa Soba, wait second before eating. For the 3rd kind of Okinawa Soba, eat it as soon as it is purchased. Thus, it is possible to eat grams of noodles and grams of soup.
Input Example 2
5 20 24
8 1
4 6
10 3
10 2
5 10
Output Example 2
-1
Because there is less than grams of soup in total, it is impossible to meet Wolf Sothe’s need even if all kinds of Okinawa Soba were purchased. Thus, output -1
.
Input Example 3
5 6 8
1 3
6 2
2 3
3 5
1 4
Output Example 3
3