#Q14. 「一本通 1.2 例 3」曲线

「一本通 1.2 例 3」曲线

Description

Ming Ming encountered nn quadratic functions Si(x)=ax2+bx+cS_i(x)= ax^2 + bx + c while doing homework. He whimsically designed a new function F(x)=max{Si(x)},i=1nF(x) = \max\{S_i(x)\}, i = 1\ldots n.

Ming Ming now wants to find the minimum value of this function over the interval [0,1000][0,1000], accurate to four decimal places, rounded.

Input Format

The input contains TT test cases. The first line of each test case is an integer nn;

The next nn lines each contain 33 integers aa, bb, cc, representing the coefficients of each quadratic function. Note: The quadratic function may degenerate into a linear one.

Output Format

For each test case, output one line representing the minimum value of the new function F(x)F(x) over the interval [0,1000][0,1000]. The result should be accurate to four decimal places, rounded.

Sample 1

2
1
2 0 0
2
2 0 0
2 -4 2

0.0000
0.5000

Data Range and Hints

For 50%50\% of the data, 1n1001 \leq n \leq 100;

For 100%100\% of the data, 1T101 \leq T \leq 10, 1n1051 \leq n \leq 10^5, 0a1000 \leq a \leq 100, 0b50000 \leq |b| \leq 5000, 0c50000 \leq |c| \leq 5000.