TV Transmitters

No attempts yetTime limit1sMemory limit128 MB

Problem

The mayor decided to install a new TV transmission system. The city is a segment of length DD, and NN buildings stand on it. A building is narrow enough that its width can be ignored, so building ii is a segment that rises from one point of the ground up to height HiH_i. Some buildings carry a TV transmitter on the roof, and the size of a transmitter is ignored as well.

A transmitter sends its signal in every direction. The signal travels along a straight line and cannot pass through a building. Some points of the ground receive a signal and others do not. A point pp receives a signal when the segment joining pp to one of the transmitters is blocked by no building.

Write a program that adds up the length of every part of the ground that receives a signal. The receiving part can be split into several pieces.

Input

The first line contains the number of buildings NN (1N3×1051 \le N \le 3 \times 10^5) and the length of the city DD (1D1091 \le D \le 10^9).

Each of the next NN lines describes one building with three integers.

  1. The first integer is 11 if a transmitter sits on the roof of that building, and 00 if it does not.
  2. The second integer is the distance XiX_i (0XiD0 \le X_i \le D) from the left end of the city to the building.
  3. The third integer is the height HiH_i (1Hi1091 \le H_i \le 10^9) of the building.

The buildings come in increasing order of their distance from the left end. No two buildings stand at the same position.

Output

Print the total length of the receiving part on one line as an irreducible fraction p/qp/q. That is, take the two integers with q1q \ge 1 and gcd(p,q)=1\gcd(p, q) = 1, and write them in the form p/q. The answer is always rational, so print the exact fraction instead of rounding. Keep the denominator even when the total length is an integer. Print 6/1 for a length of 66, and 0/1 for a length of 00.