#P10505. Maximizing Cumulative Average Score

    ID: 12520 Type: Default 1000ms 256MiB

Maximizing Cumulative Average Score

Maximizing Cumulative Average Score

In a course, you have taken (n) tests. In the (i)-th test you solved (a_i) problems correctly out of (b_i) problems. Your cumulative average score is defined as: [ 100 \times \frac{\sum_{i=1}^n a_i}{\sum_{i=1}^n b_i} ] You are allowed to drop exactly (k) test scores. Determine the maximum possible cumulative average score you can achieve by removing any (k) tests.

For example, suppose you took 3 tests with scores (5/5, 0/1,) and (2/6).
Without dropping any test, your score is [ 100 \times \frac{5+0+2}{5+1+6} \approx 58.33 \approx 58, ] while dropping the third test yields [ 100 \times \frac{5+0}{5+1} \approx 83.33 \approx 83. ] Thus, the answer in this case is 83.

inputFormat

The first line contains two integers (n) and (k) (with (1 \leq n \leq 10^5) and (0 \leq k < n)). Each of the next (n) lines contains two integers (a_i) and (b_i) representing the number of correctly solved problems and the total number of problems for the (i)-th test. It is guaranteed that (0 \leq a_i \leq b_i) and (b_i > 0).

outputFormat

Output a single integer representing the maximum cumulative average score you can achieve (after multiplying the ratio by 100 and rounding down to an integer).

sample

3 1
5 5
0 1
2 6
83