#T110. 最小函数值 (minval)

最小函数值 (minval)

Description

There are nn functions, denoted as F1,F2,...,FnF_1, F_2, ..., F_n. Each function is defined as Fi(x)=Aix2+Bix+CiF_i(x) = A_i x^2 + B_i x + C_i where xNx \in \mathbb{N}^*.
Given the coefficients AiA_i, BiB_i, and CiC_i for each function, determine the smallest mm function values among all possible values generated by these functions (if there are duplicates, output them multiple times).

Input Format

The first line contains two positive integers nn and mm.
Each of the following nn lines contains three positive integers representing the coefficients AiA_i, BiB_i, and CiC_i for the ii-th function. It is guaranteed that Ai10A_i \leq 10, Bi100B_i \leq 100, and Ci10000C_i \leq 10000.

Output Format

Output the first mm smallest function values from the sorted list of all possible values generated by these nn functions. The mm numbers should be printed on a single line, separated by spaces.

3 10
4 5 3
3 4 5
1 7 1

9 12 12 19 25 29 31 44 45 54

Hint

【Data Scale】 n,m10000n, m \leq 10000.