#include using namespace std; template struct Vector3 { T x,y,z; Vector3 operator+(const Vector3 &v) { return { x + v.x, y + v.y, z + v.z }; } Vector3 operator-(const Vector3 &v) { return { x - v.x, y - v.y, z - v.z }; } T dot(const Vector3 &v) { return x * v.x + y * v.y + z * v.z; } Vector3 cross(Vector3 v) { return { y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x }; } T abs() { return sqrt(x * x + y * y + z * z); } }; int main() { #ifdef DEBUG std::ifstream in("/home/share/inputf.in"); std::cin.rdbuf(in.rdbuf()); #endif int N; cin >> N; Vector3 P; vector> V(N); cin >> P.x >> P.y >> P.z; for(int i = 0; i < N; i++) { cin >> V[i].x >> V[i].y >> V[i].z; } double ans = 0; // O(N^3) for(int i = 0; i < N; i++) { for(int j = i + 1; j < N; j++) { Vector3 v1 = V[j] - V[i]; for(int k = j + 1; k < N; k++) { Vector3 norm = v1.cross(V[k] - V[i]); ans += abs(norm.dot(P) - norm.dot(V[i])) / norm.abs(); } } } cout << std::fixed << std::setprecision(15) << ans << endl; return 0; }