As oil prices plummet, Pengu the Penguin has decided to visit Squeaky the Mouse who lives D kilometres away.
Pengu’s spheniscidae-mobile starts its journey with F litres of fuel, consumes 1 litre of fuel per kilometre, and is able to hold any amount of fuel at any point in time.
Furthermore, there are N fuel stations between Pengu and his destination, with the ith fuel station being Xi kilometres away from Pengu’s house. At each fuel station, Pengu is only able to top up Ai litres of fuel (a limit imposed to prevent drivers from hoarding cheap fuel), and only if F ≤ Bi (to ensure that the fuel goes to drivers who most need it), Here, F refers to the amount of fuel (in litres) that Pengu started with.
Being an efficient penguin, Pengu would like to minimise the value of F while still being able to reach his destination.
Your program must read from standard input. The first line contains two integers N and D. N lines will follow. The ith line contains three integers Xi, Ai and Bi, which represent the ith fuel station.
Your program must print to standard output. The output should contain a single integer on a single line, the minimum value of F needed to reach the destination.