#include #include #include using namespace std; const int BUF = 305; class Point{ public: double x, y, z; Point(){} Point(double x, double y, double z): x(x), y(y), z(z){} Point operator- (const Point &opp) { return Point(x - opp.x, y - opp.y, z - opp.z); } void normalize() { double d = sqrt(x * x + y * y + z * z); x /= d; y /= d; z /= d; } }; // 二つのベクトルの内積を取る double dot(const Point &a, const Point &b) { return a.x * b.x + a.y * b.y + a.z * b.z; } // 二つのベクトルの外積を取る Point cross(const Point &a, const 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 nPt; Point P; Point pt[BUF]; void read() { cin >> nPt; cin >> P.x >> P.y >> P.z; for (int i = 0; i < nPt; ++i) cin >> pt[i].x >> pt[i].y >> pt[i].z; } double calc(Point p, Point a, Point b, Point c) { // abc の法線ベクトル n を求める Point ab = b - a; Point bc = c - b; Point n = cross(ab, bc); n.normalize(); // 平面上の任意の点として a をとり、 ベクトル pa と 法線ベクトル n の内積を取る Point pa = a - p; return fabs(dot(pa, n)); } void work() { double sum = 0; for (int i = 0; i < nPt; ++i) for (int j = i + 1; j < nPt; ++j) for (int k = j + 1; k < nPt; ++k) sum += calc(P, pt[i], pt[j], pt[k]); printf("%.12lf\n", sum); } int main() { read(); work(); return 0; }