It's another Start\[c\]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contain exactly _S_ slices.
It is known that the _i_\-th contestant will eat _s__i_ slices of pizza, and gain _a__i_ happiness for each slice of type 1 pizza they eat, and _b__i_ happiness for each slice of type 2 pizza they eat. We can order any number of type 1 and type 2 pizzas, but we want to buy the minimum possible number of pizzas for all of the contestants to be able to eat their required number of slices. Given that restriction, what is the maximum possible total happiness that can be achieved?
## Input
The first line of input will contain integers _N_ and _S_ (1 ≤ _N_ ≤ 105, 1 ≤ _S_ ≤ 105), the number of contestants and the number of slices per pizza, respectively. _N_ lines follow.
The _i_\-th such line contains integers _s__i_, _a__i_, and _b__i_ (1 ≤ _s__i_ ≤ 105, 1 ≤ _a__i_ ≤ 105, 1 ≤ _b__i_ ≤ 105), the number of slices the _i_\-th contestant will eat, the happiness they will gain from each type 1 slice they eat, and the happiness they will gain from each type 2 slice they eat, respectively.
## Output
Print the maximum total happiness that can be achieved.
[samples]
## Note
In the first example, you only need to buy one pizza. If you buy a type 1 pizza, the total happiness will be 3·5 + 4·6 + 5·9 = 84, and if you buy a type 2 pizza, the total happiness will be 3·7 + 4·7 + 5·5 = 74.
这是另一次 Start[c]up 决赛,意味着需要为现场参赛者订购披萨。只有两种类型的披萨(显然不是,但为了问题的需要,我们就这样假设),且所有披萨都恰好包含 #cf_span[S] 片。
已知第 #cf_span[i] 位参赛者将吃掉 #cf_span[si] 片披萨,每吃一片第一类披萨可获得 #cf_span[ai] 的幸福感,每吃一片第二类披萨可获得 #cf_span[bi] 的幸福感。我们可以订购任意数量的第一类和第二类披萨,但要求购买的披萨总数尽可能少,以确保所有参赛者都能吃到他们所需的片数。在这一限制下,所能达到的最大总幸福感是多少?
输入的第一行包含两个整数 #cf_span[N] 和 #cf_span[S] #cf_span[(1 ≤ N ≤ 105, 1 ≤ S ≤ 105)],分别表示参赛者人数和每张披萨的片数。接下来有 #cf_span[N] 行。
第 #cf_span[i] 行包含三个整数 #cf_span[si]、#cf_span[ai] 和 #cf_span[bi] #cf_span[(1 ≤ si ≤ 105, 1 ≤ ai ≤ 105, 1 ≤ bi ≤ 105)],分别表示第 #cf_span[i] 位参赛者将吃的片数、每片第一类披萨带来的幸福感、每片第二类披萨带来的幸福感。
请输出所能达到的最大总幸福感。
在第一个例子中,你只需要买一张披萨。如果你买一张第一类披萨,总幸福感为 #cf_span[3·5 + 4·6 + 5·9 = 84];如果你买一张第二类披萨,总幸福感为 #cf_span[3·7 + 4·7 + 5·5 = 74]。
## Input
输入的第一行包含两个整数 #cf_span[N] 和 #cf_span[S] #cf_span[(1 ≤ N ≤ 105, 1 ≤ S ≤ 105)],分别表示参赛者人数和每张披萨的片数。接下来有 #cf_span[N] 行。第 #cf_span[i] 行包含三个整数 #cf_span[si]、#cf_span[ai] 和 #cf_span[bi] #cf_span[(1 ≤ si ≤ 105, 1 ≤ ai ≤ 105, 1 ≤ bi ≤ 105)],分别表示第 #cf_span[i] 位参赛者将吃的片数、每片第一类披萨带来的幸福感、每片第二类披萨带来的幸福感。
## Output
请输出所能达到的最大总幸福感。
[samples]
## Note
在第一个例子中,你只需要买一张披萨。如果你买一张第一类披萨,总幸福感为 #cf_span[3·5 + 4·6 + 5·9 = 84];如果你买一张第二类披萨,总幸福感为 #cf_span[3·7 + 4·7 + 5·5 = 74]。