import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random, core.bitop; import std.string, std.regex, std.conv, std.stdio, std.typecons; struct point { real x, y, z; } void main() { auto n = readln.chomp.to!size_t; auto ai = iota(n + 1) .map!(_ => readln.split.map!(to!real)) .map!(rd => point(rd[0], rd[1], rd[2])).array; auto p = ai.front; auto qi = ai[1..$]; auto bi = new bool[](n); bi[3..$] = true; real s = 0; do { auto r = qi.zip(bi).filter!("!a[1]").map!("a[0]").array; auto a = (r[1].y - r[0].y) * (r[2].z - r[0].z) - (r[2].y - r[0].y) * (r[1].z - r[0].z); auto b = (r[1].z - r[0].z) * (r[2].x - r[0].x) - (r[2].z - r[0].z) * (r[1].x - r[0].x); auto c = (r[1].x - r[0].x) * (r[2].y - r[0].y) - (r[2].x - r[0].x) * (r[1].y - r[0].y); auto d = -(a * r[0].x + b * r[0].y + c * r[0].z); auto t = (a * p.x + b * p.y + c * p.z + d).abs / (a ^^ 2 + b ^^ 2 + c ^^ 2).sqrt; s += t; } while(bi.nextPermutation); writefln("%.9f", s); }