#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000000000000 const double eps = 1e-10; template struct vector_3d{ T x,y,z; vector_3d(T a=0.0,T b=0.0,T c=0.0){ x = a; y = b; z = c; } void update_x(T a,T b){ x = a*x + b; } void update_x(T a){ update_x(0.0,a); } void update_y(T a,T b){ y = a*y + b; } void update_y(T a){ update_y(0.0,a); } void update_z(T a,T b){ z = a*z + b; } void update_z(T a){ update_z(0.0,a); } void fix_zero(){ if(abs(x) V){ return sqrt(pow(x-V.x,2.0)+pow(y-V.y,2.0)+pow(z-V.z,2.0)); } T size(){ return get_dis(vector_3d()); } //中点 vector_3d get_midpoint(vector_3d V){ V.update_x(0.5,x/2.0); V.update_y(0.5,y/2.0); V.update_z(0.5,y/2.0); return V; } T get_inner_product(vector_3d V){ return x*V.x+y*V.y+z*V.z; } T get_cross_product(vector_3d V){ return get_inner_product(this)*V.get_inner_product(V)-pow(get_inner_product(V),2.0); } vector_3d get_cross_product_vector(vector_3d V){ return vector_3d (y*V.z-z*V.y, z*V.x-x*V.z, x*V.y-y*V.x); } vector_3d &operator+=(const vector_3d &another){ update_x(1,another.x); update_y(1,another.y); update_z(1,another.z); return (*this); } vector_3d &operator-=(const vector_3d &another){ update_x(1,-another.x); update_y(1,-another.y); update_z(1,-another.z); return (*this); } vector_3d operator+(const vector_3d &another)const{ return (vector_3d(*this)+=another); } vector_3d operator-(const vector_3d &another)const{ return (vector_3d(*this)-=another); } void show(){ cout< struct line_3d{ vector_3d a,t; line_3d(vector_3d V1,vector_3d V2){ a=V1; t=V2-V1; } T get_signed_dis(vector_3d V){ vector_3d PA = a-V; return PA.get_cross_product(t)/t.size(); } T get_dis(vector_3d V){ return abs(get_signed_dis(V)); } vector_3d get_projection(vector_3d P){ T r = t.get_inner_product(P-a)/t.size(); vector_3d temp = t; temp.normalize(); temp.x*=r; temp.y*=r; temp.z*=r; return a+temp; } /* vector_3d get_cross_point(line_3d L){ vector_3d ret(1e20,1e20); if(abs(L.a*b-a*L.b)>=eps){ ret.update_x((L.b*c-b*L.c)/(L.a*b-a*L.b)); ret.update_y((a*L.c-L.a*c)/(L.a*b-a*L.b)); } return ret; } */ }; template struct plane{ vector_3d a,t0,t1; plane(vector_3d V1,vector_3d V2,vector_3d V3){ a = V1; t0 = V2-V1; t1 = V3-V2; } T get_signed_dis(vector_3d V){ vector_3d PA = a-V; vector_3d cp = t0.get_cross_product_vector(t1); cp.normalize(); return cp.get_inner_product(PA); } T get_dis(vector_3d V){ return abs(get_signed_dis(V)); } }; int main(){ int N; cin>>N; vector_3d p; { double x,y,z; cin>>x>>y>>z; p = vector_3d(x,y,z); } vector> q(N); rep(i,N){ double x,y,z; cin>>x>>y>>z; q[i] = vector_3d(x,y,z); } double ans = 0.0; rep(i,N){ for(int j=i+1;j P(q[i],q[j],q[k]); ans += P.get_dis(p); } } } cout<