创建于 2026/07/17 · 更新于 2026/07/17
Colin is a big fan of the Dune series movies and was deeply impressed by the scene in which Paul Atreides summons and rides a giant sandworm!
Colin noticed that the timing of summoning sandworms is very important. There are always so many mysteries hidden under the calm dunes! Therefore, he modeled "Summoning Sandworms" and designed a problem for you:
To simplify the problem, we describe the topography of the dunes with a one-dimensional numerical axis. There are sandworms moving parallel to the number axis. Specifically, at the initial time , the body of the -th sandworm can be described by the segment (thus, the length of the -th sandworm is ), and it will move in the positive direction of the number axis at a speed of per second. That is, at time , the body of the -th worm can be described by the segment .
Your position is at coordinate , and you can choose any nonnegative real number time to summon sandworms passing through your position (i.e., at time , the coordinate ). However, there may be more than one sandworm passing through your position at this moment. In this case, you can only summon the shortest one among these sandworms.
There's nothing more exciting than summoning a giant sandworm! So Colin wants to know what is the longest length of sandworm you can possibly summon.
The first line contains two integers , representing the number of sandworms and your position.
In the following lines, each line contains three integers , describing the -th sandworm.
It's guaranteed that at least one sandworm will pass by your position.
Output a single integer representing the longest length of sandworm you can possibly summon.
4 3
4 1000000000 1
2 4 1
1 1000000000 1000000000
1 2 3
2