import sequtils,strutils,math type vector = tuple[x, y, z : float64] proc `+`(a, b : vector) : vector = result = (a.x + b.x, a.y + b.y, a.z + b.z) proc `-`(a, b : vector) : vector = result = (a.x - b.x, a.y - b.y, a.z - b.z) proc `*`(a : float64, b : vector) : vector = result = (a * b.x, a * b.y, a * b.z) proc `*`(a, b : vector) : float64 = result = a.x * b.x + a.y * b.y + a.z * b.z proc abs(a : vector) : float64 = if a.x > 0.0001 or a.x < -0.0001: result = abs(a.x) * sqrt(1 + pow(a.y / a.x, 2) + pow(a.z / a.x, 2)) elif a.y > 0.0001 or a.y < -0.0001: result = abs(a.y) * sqrt(1 + pow(a.z / a.y, 2)) else: result = abs(a.z) proc `=~`[T](a, b : T) : bool = if abs(a - b) < 0.00001: return true else: return false proc solve2eq(a, b : array[3, float64]) : tuple[x, y : float64] = var a = a var b = b if b[0] == 0: result.y = b[2] / b[1] result.x = (a[2] - a[1] * result.y) / a[0] return for i in countdown(2, 0): b[i] = b[i] / b[0] * a[0] for i in 0..2: b[i] -= a[i] result.y = b[2] / b[1] result.x = (a[2] - a[1] * result.y) / a[0] return proc hypotM(a, b, c : vector) : float64 = var n, k : float64 t, s, d : vector t = c - a s = b - a var A,B : array[3, float64] A = [t * t, t * s, - (a * t)] B = [t * s, s * s, - (a * s)] (n, k) = solve2eq(A, B) d = n * t + k * s + a return abs(d) var N = stdin.readline.parseInt P : seq[float64] = stdin.readline.split.map(parsefloat) T = newSeqWith(N, newSeq[float64](3)) for n in 0..