#!/usr/bin/env pypy3 import collections import itertools import math class Vector3(collections.namedtuple("Vector3", "x y z")): __slots__ = () def __add__(self, other): return Vector3(*(s + o for s, o in zip(self, other))) def __sub__(self, other): return Vector3(*(s - o for s, o in zip(self, other))) def __mul__(self, other): # cross product m1 = self.y * other.z - self.z * other.y m2 = self.z * other.x - self.x * other.z m3 = self.x * other.y - self.y * other.x return Vector3(m1, m2, m3) def __neg__(self): return Vector3(-self.x, -self.y, -self.z) def __pos__(self): return Vector3(+self.x, +self.y, +self.z) def __abs__(self): # norm return math.sqrt(sum(s * s for s in self)) def dotproduct(self, other): return sum(s * o for s, o in zip(self, other)) def angle(self, other): return math.acos(self.dotproduct(other) / abs(self) / abs(other)) def scale(self, k): return Vector3(k * self.x, k * self.y, k * self.z) def dist(q1, q2, q3): v1 = q2 - q1 v2 = q3 - q2 cp = v1 * v2 return abs(q1.dotproduct(cp)) / abs(cp) def solve(p, qs): return sum(dist(*q123) for q123 in itertools.combinations(qs, 3)) def main(): n = int(input()) p = Vector3(*map(float, input().split())) qs = [Vector3(*map(float, input().split())) - p for _ in range(n)] print("{:.12f}".format(solve(p, qs))) if __name__ == '__main__': main()