This page is still under construction.

Parts of this page are still being built. What you see may change.

Kkung's Space Trip

Interview

Time limit2sMemory limit128 MB

Summary
Count the ships that reach the destination by checking whether each ship's fuel covers its burn rate over the travel time.
Level

Easy1 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Kkung wants to travel through space, so he started planning a trip. After weighing a few things, he decided that a ship's fuel and the time it takes to reach the destination matter most. Kkung is enormously rich and owns several spaceships, and each one has a slightly different top speed and fuel consumption rate. The fuel consumption rate is the amount of fuel burned per unit of time.

Assume every ship reaches its top speed the moment it departs. Work out for Kkung how many of his ships can travel all the way to the place he wants to visit.

Input

The first line contains the number of test cases TT (1≤T≤501 \le T \le 50).

The first line of each test case contains two integers separated by a space: the number of ships NN (1≤N≤1001 \le N \le 100) and the distance to the destination DD (1≤D≤1061 \le D \le 10^6). Each of the next NN lines contains three integers separated by spaces: a ship's top speed viv_i (1≤vi≤10001 \le v_i \le 1000), its amount of fuel fif_i (1≤fi≤10001 \le f_i \le 1000), and its fuel consumption rate cic_i (1≤ci≤10001 \le c_i \le 1000).

Output

For each test case, print the number of ships that can reach the destination, one per line.

Watch out for integer division.

Examples1

  1. Example 1

    Input
    2
    3 100
    52 75 10
    88 13 44
    56 9 5
    2 920368
    950 950 1
    943 976 1
    
    Expected output
    2
    1