Hamster 2#703

Hamster 2

1 second
64 megabytes
Easy

A competition of flying hamsters is held in Hamsterburg. Each hamster competing in the contest is launched with a sling. The initial speed of the hamsters is V_0 m/s. The acceleration due to gravity is g = 10 m/s^2. Air resistance is neglected. The sizes of the hamsters and the sling are considered negligible. When a hamster is launched, it is at height meters above the ground. There are several vertical gates in the air. Each gate has a lower and an upper bound. If you mark points on the ground directly under each gate, all these points would be on a straight line and on one side of the starting point. A hamster scores exactly as many points as the number of gates it flies through. You need to determine the maximum number of points a hamster can earn in a single flight. A hamster is considered to fly through a gate if it either touches the bounds of the gate, or flies precisely between them.

Input

The first line contains the number of tests 0 < t \leq 10. The description of each test follows. Each test begins with two integers: 0 < V_0 \leq 1000 — the initial speed of the hamster, and 0 < n \leq 20000 — the number of gates. The next lines each contain the characteristics of a gate: three integers 0 < x \leq 10000 — the distance from the starting point to the point on the ground directly under the gate, and 0 < y_1 \leq y_2 \leq 10000 — the lower and upper bounds of the gate.

Output

For each test, output the maximal number of gates a hamster can fly through in one flight, in a separate line.

Examples

Example 1

Loading
Loading