#include "bits/stdc++.h" using namespace std; #define int long long #define FOR(i, a, b) for(int i=(a);i<(b);i++) #define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--) #define REP(i, n) for(int i=0; i<(n); i++) #define RREP(i, n) for(int i=(n-1); i>=0; i--) #define ALL(a) (a).begin(),(a).end() #define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end()); #define CONTAIN(a, b) find(ALL(a), (b)) != (a).end() #define array2(type, x, y) array, x> #define vector2(type) vector > #define out(...) printf(__VA_ARGS__) int dxy[] = {0, 1, 0, -1, 0}; /*================================*/ int N,M,L; template struct Pos { T x, y, z; Pos(){}; Pos(T _x, T _y): x(_x), y(_y){}; Pos(T _x, T _y, T _z): x(_x), y(_y), z(_z){}; Pos operator * (T t) { return Pos(t * x, t * y, t * z); } Pos operator + (Pos q) { return Pos(x + q.x, y + q.y, z + q.z); } Pos operator - (Pos q) { return Pos(x - q.x, y - q.y, z - q.z); } int dot(Pos q) { return x*q.x + y*q.y + z*q.z; } Pos det(Pos q) { return Pos( y*q.z - z*q.y , z*q.x - x*q.z , x*q.y - y*q.x ); } bool operator == (Pos q) { return (x == q.x) && (y == q.y) && (z == q.z); } Pos operator * ( const Pos& q ) { return det(q); } T operator % ( const Pos& q ) { return dot(q); } T norm() { return sqrt(x*x + y*y + z*z); } }; typedef Pos pos; pos p; vector X(444); double dist(int i, int j, int k) { pos a = X[i], b = X[j], c = X[k]; pos pa =a-p, pb=b-p, pc=c-p; auto v = ((pa * pb) % pc); auto s = ((b-a)*(c-a)).norm(); return abs(v/s); } signed main() { #if DEBUG std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf()); #endif cin>>N; cin>>p.x>>p.y>>p.z; REP(i,N)cin>>X[i].x>>X[i].y>>X[i].z; double ans = 0; FOR(i,0,N-2) FOR(j,i+1,N-1) FOR(k,j+1,N) { ans += dist(i,j,k); } out("%.14lf\n", ans); return 0; }