import sys
import math
from itertools import combinations

def main():
    input = sys.stdin.read().split()
    ptr = 0
    N = int(input[ptr])
    ptr += 1
    Px = float(input[ptr])
    Py = float(input[ptr+1])
    Pz = float(input[ptr+2])
    ptr += 3

    x, y, z = [], [], []
    for _ in range(N):
        xi = float(input[ptr])
        yi = float(input[ptr+1])
        zi = float(input[ptr+2])
        x.append(xi)
        y.append(yi)
        z.append(zi)
        ptr += 3

    # Precompute AP vectors for all points
    APx = [Px - xi for xi in x]
    APy = [Py - yi for yi in y]
    APz = [Pz - zi for zi in z]

    sum_dist = 0.0

    for i, j, k in combinations(range(N), 3):
        # Vectors AB and AC
        ABx = x[j] - x[i]
        ABy = y[j] - y[i]
        ABz = z[j] - z[i]
        ACx = x[k] - x[i]
        ACy = y[k] - y[i]
        ACz = z[k] - z[i]

        # Cross product (normal vector)
        a = ABy * ACz - ABz * ACy
        b = ABz * ACx - ABx * ACz
        c = ABx * ACy - ABy * ACx

        # AP vector for point i
        apx = APx[i]
        apy = APy[i]
        apz = APz[i]

        # Dot product
        dot = a * apx + b * apy + c * apz
        numerator = abs(dot)
        denominator = math.sqrt(a*a + b*b + c*c)

        sum_dist += numerator / denominator

    print("{0:.15f}".format(sum_dist))

if __name__ == '__main__':
    main()