TV Transmitters
Time limit1sMemory limit128 MB
Some rooftops hold transmitters, buildings block their straight rays, and the total length of ground that sees one transmitter is printed as a reduced fraction.
Problem
The mayor decided to install a new TV transmission system. The city is a segment of length , and buildings stand on it. A building is narrow enough that its width can be ignored, so building is a segment that rises from one point of the ground up to height . 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 receives a signal when the segment joining 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 () and the length of the city ().
Each of the next lines describes one building with three integers.
- The first integer is if a transmitter sits on the roof of that building, and if it does not.
- The second integer is the distance () from the left end of the city to the building.
- The third integer is the height () 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 . That is, take the two integers with and , 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 , and 0/1 for a length of .