#include <bits/stdc++.h>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;

struct Point{
    double x, y, z;
    
    Point() = default;
    Point(double x, double y, double z) : x(x), y(y), z(z) {}

    double abs(){
        return std::sqrt(x * x + y * y + z * z);
    }

    Point& operator+=(Point &rhs){
        x += rhs.x; y += rhs.y; z += rhs.z;
        return *this;
    }

    friend Point operator+(Point lhs, Point &rhs){return lhs += rhs;}

    Point& operator-=(Point &rhs){
        x -= rhs.x; y -= rhs.y; z -= rhs.z;
        return *this;
    }

    friend Point operator-(Point lhs, Point &rhs){return lhs -= rhs;}

    friend std::istream& operator>>(std::istream &is, Point &p){return is >> p.x >> p.y >> p.z;}
};

Point cross(Point p, Point q){
    return {p.y * q.z - p.z * q.y, -(p.x * q.z - p.z * q.x), p.x * q.y - p.y * q.x};
}

double dot(Point p, Point q){
    return p.x * q.x + p.y * q.y + p.z * q.z;
}

int N;
Point p, qs[300];

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> N;

    std::cin >> p;

    for(int i=0;i<N;++i){
        std::cin >> qs[i];
    }

    double sum = 0;

    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
            for(int k=j+1;k<N;++k){
                Point n = cross(qs[j] - qs[i], qs[k] - qs[i]);
                double d = dot(qs[i], n);
                double dist = std::abs(dot(p, n) - d) / n.abs();
                sum += dist;
            }
        }
    }

    printf("%.10f\n", sum);
}