#P8295. NSC's Sausage Challenge

    ID: 21474 Type: Default 1000ms 256MiB

NSC's Sausage Challenge

NSC's Sausage Challenge

NSC, a nationwide chain supermarket, claims that its Italian sausage is the cheapest in the country. In fact, if a customer finds a cheaper sausage at any other chain store, NSC will match the price difference.

Matej and Filip have decided to take up the challenge and visit N different chain stores to find a sausage that is not only cheaper than NSC’s but also the lowest-priced in the market. If they succeed, they can purchase 1000 grams of sausage at a nearby NSC branch according to the lowest market price.

Note that all chain stores (including NSC) list their sausage price in a slightly complex manner: a price is given as $X$ yuan for $Y$ grams of sausage. In case a competitor offers a lower unit price, NSC will charge the customer that lower rate.

Your task is to write a program that, given the sausage prices from NSC and the remaining N chain stores, computes the amount Matej and Filip must pay at the NSC branch for 1000 grams of sausage.

inputFormat

The input consists of several lines:

  • The first line contains an integer N indicating the number of other chain stores.
  • The second line contains two integers X and Y representing NSC's price: X yuan for Y grams.
  • Each of the next N lines contains two integers X and Y indicating the price in a competitor store: X yuan for Y grams.

You may assume that all values are positive integers.

outputFormat

Output a single number, which is the amount (in yuan) that must be paid for 1000 grams of sausage at NSC after applying the price matching policy. The answer should be computed as:

\(\text{answer} = \min\left(\frac{X_{NSC}}{Y_{NSC}}, \min_{i=1}^N \frac{X_i}{Y_i}\right) \times 1000\)

It is guaranteed that a relative or absolute error of up to 10-6 is acceptable.

sample

3
10 500
8 500
12 600
10 520
16.000000