# https://yukicoder.me/problems/no/132 import math def inner_prod(v1, v2): ans =0 for l in range(3): ans += v1[l] * v2[l] return ans def norm2(v1): ans =0 for l in range(3): ans += v1[l] * v1[l] return ans def main(): N = int(input()) P = tuple(map(float, input().split())) xyz = [] for _ in range(N): p = tuple(map(float, input().split())) xyz.append(p) answer = 0 for i in range(N): p0 = xyz[i] v3 = tuple([P[l] - p0[l] for l in range(3)]) for j in range(i + 1, N): p1 = xyz[j] v1 = tuple([p1[l] - p0[l] for l in range(3)]) for k in range(j + 1, N): p2 = xyz[k] v2 = tuple([p2[l] - p0[l] for l in range(3)]) # 係数の計算 v1v2 = inner_prod(v1, v2) v3v1 = inner_prod(v3, v1) v3v2 = inner_prod(v3, v2) v1_n2 = norm2(v1) v2_n2 = norm2(v2) v3_n2 = norm2(v3) matrix = [ [v2_n2, -v1v2], [-v1v2, v1_n2] ] vector = [v3v1, v3v2] new_vector = [0, 0] for i in range(2): for j in range(2): new_vector[i] += vector[j] * matrix[i][j] d = v2_n2 * v1_n2 - v1v2 ** 2 ans = v3_n2 - (new_vector[0] * v3v1 / d) - (new_vector[1] * v3v2 / d) answer += math.sqrt(ans) print(answer) if __name__ == "__main__": main()