← Home
write a go solution for Description:
Monocarp is planning on opening a chemistry lab. During the first month, he's going to distribute solutions of a certain acid.

First, he will sign some contracts with a local chemistry factory. Each contract provides Monocarp with an unlimited supply of some solution of the same acid. The factory provides n contract options, numbered from 1 to n. The i-th solution has a concentration of x_i%, the contract costs w_i burles, and Monocarp will be able to sell it for c_i burles per liter.

Monocarp is expecting k customers during the first month. Each customer will buy a liter of a y%-solution, where y is a real number chosen uniformly at random from 0 to 100 independently for each customer. More formally, the probability of number y being less than or equal to some t is P(y<=t)=t/100.

Monocarp can mix the solution that he signed the contracts with the factory for, at any ratio. More formally, if he has contracts for m solutions with concentrations x_1,x_2,...,x_m, then, for these solutions, he picks their volumes a_1,a_2,...,a_m so that sumlimits_i=1^ma_i=1 (exactly 1 since each customer wants exactly one liter of a certain solution).

The concentration of the resulting solution is sumlimits_i=1^mx_i*a_i. The price of the resulting solution is sumlimits_i=1^mc_i*a_i.

If Monocarp can obtain a solution of concentration y%, then he will do it while maximizing its price (the cost for the customer). Otherwise, the customer leaves without buying anything, and the price is considered equal to 0.

Monocarp wants to sign some contracts with a factory (possibly, none or all of them) so that the expected profit is maximized — the expected total price of the sold solutions for all k customers minus the total cost of signing the contracts from the factory.

Print the maximum expected profit Monocarp can achieve.

Input Format:
The first line contains two integers n and k (1<=n<=5000; 1<=k<=10^5) — the number of contracts the factory provides and the number of customers.

The i-th of the next n lines contains three integers x_i,w_i and c_i (0<=x_i<=100; 1<=w_i<=10^9; 1<=c_i<=10^5) — the concentration of the solution, the cost of the contract and the cost per liter for the customer, for the i-th contract.

Output Format:
Print a single real number — the maximum expected profit Monocarp can achieve.

Your answer is considered correct if its absolute or relative error does not exceed 10^-6.

Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if frac|a-b|max(1,|b|)<=10^-6.

Note:
None. Output only the code with no comments, explanation, or additional text.