#include using namespace std; struct P { double x; double y; double z; P() : x(0), y(0), z(0) {} P(double x, double y, double z) : x(x), y(y), z(z) {} P operator-(const P& p) const { return P(x - p.x, y - p.y, z - p.z); } }; int n; P p; vector

q; P cross(P a, P b) { P res; res.x = a.y * b.z - a.z * b.y; res.y = a.z * b.x - a.x * b.z; res.z = a.x * b.y - a.y * b.x; return res; } double dist(int i, int j, int k) { P a = q[j] - q[i], b = q[k] - q[i]; P c = cross(a, b); double d = -c.x * q[i].x - c.y * q[i].y - c.z * q[i].z; double res = abs(c.x * p.x + c.y * p.y + c.z * p.z + d); res /= sqrt(c.x * c.x + c.y * c.y + c.z * c.z); return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n >> p.x >> p.y >> p.z; q.resize(n); for (int i = 0; i < n; i++) cin >> q[i].x >> q[i].y >> q[i].z; double ans = 0.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 += dist(i, j, k); } } } cout << fixed << setprecision(10) << ans << endl; return 0; }