#HITACHI2020D. Manga Market

Manga Market

Score : 800800 points

Problem Statement

There are NN stores called Store 11, Store 22, \cdots, Store NN. Takahashi, who is at his house at time 00, is planning to visit some of these stores.

It takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.

If Takahashi reaches Store ii at time tt, he can do shopping there after standing in a queue for ai×t+bia_i \times t + b_i units of time. (We assume that it takes no time other than waiting.)

All the stores close at time T+0.5T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.

Takahashi does not do shopping more than once in the same store.

Find the maximum number of times he can do shopping before time T+0.5T + 0.5.

Constraints

  • All values in input are integers.
  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 0ai1090 \leq a_i \leq 10^9
  • 0bi1090 \leq b_i \leq 10^9
  • 0T1090 \leq T \leq 10^9

Input

Input is given from Standard Input in the following format:

NN TT

a1a_1 b1b_1

a2a_2 b2b_2

\vdots

aNa_N bNb_N

Output

Print the answer.

3 7
2 0
3 2
0 3
2

Here is one possible way to visit stores:

  • From time 00 to time 11: in 11 unit of time, he travels from his house to Store 11.
  • From time 11 to time 33: for 22 units of time, he stands in a queue for Store 11 to do shopping.
  • From time 33 to time 44: in 11 unit of time, he travels from Store 11 to Store 33.
  • From time 44 to time 77: for 33 units of time, he stands in a queue for Store 33 to do shopping.

In this way, he can do shopping twice before time 7.57.5.

1 3
0 3
0
5 21600
2 14
3 22
1 3
1 10
1 9
5
7 57
0 25
3 10
2 4
5 15
3 22
2 14
1 15
3