atcoder#RELAY2E. White and Blue

White and Blue

Score : 100100 points

Problem Statement

Ringo Kingdom Congress is voting on a bill.

NN members are present, and the ii-th member (1iN)(1 \leq i \leq N) has wiw_i white ballots and bib_i blue ballots. Each member ii will put all the wiw_i white ballots into the box if he/she is in favor of the bill, and put all the bib_i blue ballots into the box if he/she is not in favor of the bill. No other action is allowed. For example, a member must not forfeit voting, or put only a part of his/her white ballots or a part of his/her blue ballots into the box.

After all the members vote, if at least PP percent of the ballots in the box is white, the bill is passed; if less than PP percent of the ballots is white, the bill is rejected.

In order for the bill to pass, at least how many members must be in favor of it?

Constraints

  • 1N1051 \leq N \leq 10^5
  • 1P1001 \leq P \leq 100
  • 1wi1091 \leq w_i \leq 10^9
  • 1bi1091 \leq b_i \leq 10^9
  • All input values are integers.

Input

Input is given from Standard Input in the following format:

NN PP

w1w_1 b1b_1

w2w_2 b2b_2

::

wNw_N bNb_N

Output

Print the minimum number of members in favor of the bill required for passage.

4 75
1 1
1 1
1 1
1 1
3

This is a "normal" vote, where each of the four members has one white ballot and one blue ballot. For the bill to pass, at least 7575 percent of the four, that is, at least three must be in favor of it.

4 75
1 1
1 1
1 1
100 1
1

The "yes" vote of the member with 100100 white ballots alone is enough to pass the bill.

5 60
6 3
5 9
3 4
7 8
4 7
3