import java.util.Scanner; public class Main_yukicoder132 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); double[] p = new double[3]; for (int i = 0; i < 3; i++) { p[i] = sc.nextDouble(); } double[][] xyz = new double[n][3]; for (int i = 0; i < n; i++) { xyz[i][0] = sc.nextDouble(); xyz[i][1] = sc.nextDouble(); xyz[i][2] = sc.nextDouble(); } double ret = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { double[] nn = cross(xyz[i], xyz[j], xyz[k]); double d1 = -(nn[0] * xyz[i][0] + nn[1] * xyz[i][1] + nn[2] * xyz[i][2]); // double d2 = nn[0] * xyz[j][0] + nn[1] * xyz[j][1] + nn[2] * xyz[j][2]; // double d3 = nn[0] * xyz[k][0] + nn[1] * xyz[k][1] + nn[2] * xyz[k][2]; // System.out.printf("%f %f %f\n", d1, d2, d3); ret += dist(p, nn[0], nn[1], nn[2], d1); } } } System.out.println(ret); sc.close(); } private static double dist(double[] p, double a, double b, double c, double d) { double ret = Math.abs(p[0] * a + p[1] * b + p[2] * c + d); ret /= Math.sqrt(a * a + b * b + c * c); return ret; } private static double[] cross(double[] a, double[] b, double[] c) { double[] ret = new double[3]; ret[0] = (b[1] - a[1]) * (c[2] - a[2]) - (b[2] - a[2]) * (c[1] - a[1]); ret[1] = (b[2] - a[2]) * (c[0] - a[0]) - (b[0] - a[0]) * (c[2] - a[2]); ret[2] = (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); return ret; } }