#include #include #include #include #include using namespace std; template class Point3 { public: T x, y, z; Point3() {} Point3(T x, T y, T z) : x(x), y(y), z(z) {} Point3(const Point3& src) : x(src.x), y(src.y), z(src.z) {} Point3 operator-() const { return Point3(-x, -y, -z); } Point3& operator=(const Point3& a) { if (&a != this) { x = a.x; y = a.y; z = a.z; } return *this; } Point3& operator+=(const Point3& a) { x += a.x; y += a.y; z += a.z; return *this; } Point3& operator-=(const Point3& a) { x -= a.x; y -= a.y; z -= a.z; return *this; } Point3 operator+(const Point3& a) const { Point3 r = *this; r += a; return r; } Point3 operator-(const Point3& a) const { Point3 r = *this; r -= a; return r; } }; typedef Point3 Point3d; istream& operator>>(istream& in, Point3d& p) { in >> p.x >> p.y >> p.z; return in; } template class Vec { public: T val[N]; T& operator[](size_t k) { return val[k]; } const T& operator[](size_t k) const { return val[k]; } Vec() {} Vec(T a1) { val[0] = a1; } Vec(T a1, T a2) { val[0] = a1; val[1] = a2; } Vec(T a1, T a2, T a3) { val[0] = a1; val[1] = a2; val[2] = a3; } Vec(T a1, T a2, T a3, T a4) { val[0] = a1; val[1] = a2; val[2] = a3; val[3] = a4; } Vec(const Vec& src) { for (size_t i = 0; i < N; i++) { val[i] = src.val[i]; } } Vec& operator=(const Vec& src) { if (&src != this) { for (size_t i = 0; i < N; i++) { val[i] = src.val[i]; } } } Vec& operator+=(const Vec& a) { for (size_t i = 0; i < N; i++) { val[i] += a.val[i]; } } Vec& operator-=(const Vec& a) { for (size_t i = 0; i < N; i++) { val[i] -= a.val[i]; } } }; template class Vec3 : public Vec < T, 3 > { public: Vec3(const Point3& src) : Vec(src.x, src.y, src.z) {} }; typedef Vec3 Vec3d; template T dot(const Vec& a, const Vec& b) { T sum = 0; for (int i = 0; i < N; i++) { sum += a[i] * b[i]; } return sum; } class Plane { public: double a, b, c, d; Plane() {} Plane(double a, double b, double c, double d) : a(a), b(b), c(c), d(d) {} Plane(const Point3d& p1, const Point3d& p2, const Point3d& p3) { Vec3d ab = p2 - p1; Vec3d ac = p3 - p1; a = ab[1] * ac[2] - ab[2] * ac[1]; b = ab[2] * ac[0] - ab[0] * ac[2]; c = ab[0] * ac[1] - ab[1] * ac[0]; d = -(a * p1.x + b * p1.y + c * p1.z); double n = sqrt(a * a + b * b + c * c); a /= n; b /= n; c /= n; d /= n; } }; int main() { #if 0 ifstream in("test_in/len003.txt"); #define out cout #else #define in cin #define out cout #endif int n; in >> n; Point3d P; in >> P; vector Q(n); for (int i = 0; i < n; i++) { in >> Q[i]; Q[i] -= P; } double sum = 0; for (int i = 0; i < n - 2; i++) { for (int j = i + 1; j < n - 1; j++) { for (int k = j + 1; k < n; k++) { Plane plane(Q[i], Q[j], Q[k]); double distance = fabs(plane.d); sum += distance; } } } out << fixed << setprecision(9) << sum << endl; }