#P4058. Timber Order Fulfillment

    ID: 17306 Type: Default 1000ms 256MiB

Timber Order Fulfillment

Timber Order Fulfillment

We are given ( n ) trees. The ( i )-th tree has an initial height ( H_i ) and grows by ( A_i ) each month. An order requires a total timber length of ( S ), and each piece of timber must have a length of at least ( L ). Moreover, timber must be used as the whole tree (i.e., you cannot cut a tree into parts). Find the minimum number of months you need to wait so that it is possible to select some trees (each with height at least ( L )) whose total height is at least ( S ).

inputFormat

The first line contains three space-separated integers: \( n \), \( S \), and \( L \).

Then follow \( n \) lines, each containing two space-separated integers \( H_i \) and \( A_i \), representing the initial height and monthly growth of the \( i \)-th tree respectively.

outputFormat

Output a single integer: the minimum number of months required. It is guaranteed that a solution exists.

sample

3 100 15
10 2
15 1
20 2
5

</p>