#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; #define EPS 1e-10 struct V3{ double x, y, z; V3(){} V3(double x_, double y_, double z_):x(x_),y(y_),z(z_){} V3 operator+(V3 p)const{ return V3(x+p.x,y+p.y,z+p.z); } V3 operator-(V3 p)const{ return V3(x-p.x,y-p.y,z-p.z); } double dist()const{ return sqrt(x*x+y*y); } }; V3 operator *(double k, V3 p){ p.x *= k; p.y *= k; p.z *= k; return p; } double dot(const V3 &a, const V3 &b){ return a.x*b.x + a.y*b.y + a.z*b.z; } V3 cross(const V3 &a, const V3 &b){ double x, y, z; x = a.y*b.z - a.z*b.y; y = a.z*b.x - a.x*b.z; z = a.x*b.y - a.y*b.x; return V3(x, y, z); } tuple makePlane(const V3 &A, const V3 &B, const V3 &C){ V3 AB = B - A, AC = C - A; V3 n = cross(AB, AC); double a=n.x, b=n.y, c=n.z, d; d = dot(n, (-1)*A); return make_tuple(a, b, c, d); } double distPointPlane(const V3 &P, tuple l){ double a, b, c, d, res; tie(a, b, c, d) = l; res = a*P.x + b*P.y + c*P.z + d; res /= hypot(a, hypot(b, c)); return abs(res); } int main(){ int N; V3 P; cin >> N >> P.x >> P.y >> P.z; vector Q(N); each(q, Q)cin >> q.x >> q.y >> q.z; double ans = 0; rep(k, N)rep(j, k)rep(i, j){ auto l = makePlane(Q[i],Q[j],Q[k]); ans += distPointPlane(P, l); } cout << setprecision(20) << ans << endl; }