Problems
Weighted points
Weighted points
You have \textbf{N} points on \textbf{2}-\textbf{d} plane. Coordinates of each point \textbf{P_i} are (\textbf{x_i}, \textbf{y_i}). Each point has a weight \textbf{w_i} associated with it. Given a point \textbf{X}, we define the distance function \textbf{F} as
\includegraphics{https://static.e-olymp.com/content/c0/c04ac5e3345815761e34845d6fff01c373a0cd30.jpg}
Here \textbf{D}(\textbf{X},\textbf{P_i}) denotes the Euclidean distance between \textbf{X} and point \textbf{P_i}.
Find a point \textbf{X} such that distance function \textbf{F}(\textbf{x}) is minimized. Output the minimum value of \textbf{F}(\textbf{x}).
\InputFile
First line contains \textbf{T}, the number of test cases. First line of each test case contains \textbf{N}, the number of points. Each of the next \textbf{N} lines contains three space separated integers \textbf{x_i}, \textbf{y_i} and \textbf{w_i} respectively.
It is known that \textbf{T} ≤ \textbf{20}, \textbf{N} ≤ \textbf{1000}, \textbf{0} ≤ \textbf{x_i}, \textbf{y_i}, \textbf{w_i} ≤ \textbf{1000}.
\OutputFile
Output contains \textbf{T} lines, each containing minimum value of \textbf{F}(\textbf{x}) rounded to 3 decimal places.
Input example #1
1 2 0 0 1 1 1 1
Output example #1
1.414