#define _CRT_SECURE_NO_WARNINGS #include using namespace std; typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; iDUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this< ostream& operator<<(ostream& os, vector const& v){ rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" "); return os; } typedef long double R; typedef tuple P; #define PCR P const& P cross(PCR a, PCR b){ R a1,a2,a3; R b1,b2,b3; tie(a1,a2,a3) = a; tie(b1,b2,b3) = b; return mt(a2*b3-a3*b2, a3*b1-a1*b3, a1*b2-a2*b1); } P operator-(PCR a, PCR b){ R a1,a2,a3; R b1,b2,b3; tie(a1,a2,a3) = a; tie(b1,b2,b3) = b; return P(a1-b1, a2-b2, a3-b3); } P p; P ps[400]; R dist(int i, int j, int k){ R v1,v2,v3; tie(v1,v2,v3) = cross(ps[i]-ps[k],ps[j]-ps[k]); R a1,a2,a3; tie(a1,a2,a3) = ps[k]; R d = v1*a1 + v2*a2 + v3*a3; R x,y,z; tie(x,y,z) = p; return abs(v1*x + v2*y + v3*z - d) / sqrt(v1*v1 + v2*v2 + v3*v3); } int main(){ int N; while(cin>>N){ R x,y,z; cin >> x >> y >> z; p = P(x,y,z); rep(i,N){ cin >> x >> y >> z; ps[i] = P(x,y,z); } R ans = 0; rep(i,N)rep(j,i)rep(k,j) ans += dist(i,j,k); printf("%.20lf\n", (double)ans); } }