404773: GYM101628 J Jenny and the Batteries
Description
Jenny works at BBB (Battery Bank of Brazil). She's in charge of optimizing the batteries' displacements, but can't solve the problem. Knowing you are a programmer, she asked for your help.
At BBB, the batteries are arranged in piles. In a bank, the batteries can't be discharged. So, when recharging then, the bank spends M energy units, where M is the size of the greatest pile. Each pile initially has ai batteries.
There is a machine the can move a battery from pile i to pile j with cost bi + cj. Jenny has a limited budget of K for moving the batteries and the bank wants the minimum M possible at the end.
InputThe first line of input consists of the integers N and K (1 ≤ N ≤ 105, 1 ≤ K ≤ 1018). The following N lines contain ai, bi and ci (0 ≤ ai, bi, ci ≤ 106).
OutputPrint the minumum M possible.
ExampleInput5 20Output
5 3 8
2 8 3
3 2 4
7 2 1
6 1 1
5