#include #define rep(i, a) for (int i = 0; i < (a); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) for (int i = (a) - 1; i >= 0; i--) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) using namespace std; typedef long long ll; const ll inf = 1e9; const ll mod = 1e9 + 9; struct Point { double x, y, z; Point() : x(0), y(0), z(0) {} Point(double x, double y, double z) : x(x), y(y), z(z) {} Point operator +(Point p) { return Point(x + p.x, y + p.y, z + p.z); } Point operator -(Point p) { return Point(x - p.x, y - p.y, z - p.z); } Point operator *(double k) { return Point(x * k, y * k, z * k); } Point operator /(double k) { return Point(x / k, y / k, z / k); } Point &operator+=(Point p) { x += p.x; y += p.y; z += p.z; return *this; } Point &operator-=(Point p) { x -= p.x; y -= p.y; z -= p.z; return *this; } Point &operator*=(double k) { x *= k; y *= k; z *= k; return *this; } Point &operator/=(double k) { x /= k; y /= k; z /= k; return *this; } }; double norm(Point a) { return a.x * a.x + a.y * a.y + a.z * a.z; } double abs(Point a) { return sqrt(norm(a)); } double dot(Point a, Point b) { return a.x * b.x + a.y * b.y + a.z * b.z; } Point cross(Point a, Point b) { return Point(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); } int N; Point P, Q[300]; pair orthonormalize(Point u, Point v) { u /= abs(u); v -= u * dot(u, v); v /= abs(v); return make_pair(u, v); } int main() { cin >> N; cin >> P.x >> P.y >> P.z; rep (i, N) cin >> Q[i].x >> Q[i].y >> Q[i].z; double ans = 0; rep (i, N) rep2 (j, i + 1, N) rep2 (k, j + 1, N) { auto p = orthonormalize(Q[j] - Q[i], Q[k] - Q[i]); Point u = P - Q[i]; u -= p.first * dot(p.first, u) + p.second * dot(p.second, u); ans += abs(u); } printf("%.20f\n", ans); }