import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline from math import sqrt # 行基本変形(floatで計算) def row_transformation(A,x): # xは正方行列の行数 for i in range(x): for j in range(x): if i==j: continue base=A[i][i] target=A[j][i] if target==0: continue for k in range(x): A[j][k]-=A[i][k]*(target/base) return A # 逆行列を掃き出し法で計算(floatで計算) def inv_transformation(A,x): # xは正方行列の行数 for i in range(x): A[i]+=[0]*x A[i][i+x]=1 for i in range(x): for j in range(x): if i==j: continue base=A[i][i] if base!=1: for k in range(x*2): A[i][k]/=base target=A[j][i] if target==0: continue for k in range(x*2): A[j][k]-=A[i][k]*target B=[[0]*x for i in range(x)] for i in range(x): for j in range(x): B[i][j]=A[i][j+x] return B def prod(A,B,k,l,m):# A:k*l,B:l*m C=[[None for i in range(m)] for j in range(k)] for i in range(k): for j in range(m): ANS=0 for pl in range(l): ANS=(ANS+A[i][pl]*B[pl][j]) C[i][j]=ANS return C N=int(input()) x,y,z=map(float,input().split()) P=[tuple(map(float,input().split())) for i in range(N)] ANS=0 for i in range(N): for j in range(i+1,N): for k in range(j+1,N): x0,y0,z0=P[i] x1,y1,z1=P[j] x2,y2,z2=P[k] A=[[x0,y0,1],[x1,y1,1],[x2,y2,1]] INV=inv_transformation(A,3) X=prod(INV,[[z0],[z1],[z2]],3,3,1) a=X[0][0] b=X[1][0] c=X[2][0] ANS+=abs(a*x+b*y-z+c)/sqrt(a*a+b*b+1) print(ANS)