#include #include #include #include using namespace std; struct point{ double x, y, z; point(){ } 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); } }; double abs(point P){ return sqrt(P.x * P.x + P.y * P.y + P.z * P.z); } double dot(point P, point Q){ return P.x * Q.x + P.y * Q.y + P.z * Q.z; } point cross(point P, point Q){ return point(P.y * Q.z - Q.y * P.z, P.z * Q.x - Q.z * P.x, P.x * Q.y - Q.x * P.y); } double volume(point P, point Q, point R){ return abs(dot(cross(P, Q), R)); } struct plane{ point A, B, C; plane(point A, point B, point C): A(A), B(B), C(C){ } }; double point_plane_distance(point P, plane T){ return abs(volume(P - T.A, T.B - T.A, T.C - T.A)) / abs(cross(T.B - T.A, T.C - T.A)); } int main(){ cout << fixed << setprecision(15); int N; cin >> N; point P; cin >> P.x >> P.y >> P.z; vector Q(N); for (int i = 0; i < N; i++){ cin >> Q[i].x >> Q[i].y >> Q[i].z; } double ans = 0; for (int i = 0; i < N; i++){ for (int j = i + 1; j < N; j++){ for (int k = j + 1; k < N; k++){ ans += point_plane_distance(P, plane(Q[i], Q[j], Q[k])); } } } cout << ans << endl; }