require 'matrix' class Vector def outer_product(o) raise 'outer_product is size3 only(size#{self.size})' unless size == 3 Vector[ self[1]*o[2]-self[2]*o[1], self[2]*o[0]-self[0]*o[2], self[0]*o[1]-self[1]*o[0], ] end end def g;gets.split.map(&:to_f)end def cross(a,b) [a[1]*b[2]-a[2]-b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]] end n=gets.to_i p=Vector[*g] q=(1..n).map{Vector[*g]} sum=0 q.combination(3){|a,b,c| t=(b-a).outer_product(c-a) sum+=(p.inner_product(t)-a.inner_product(t)).abs/t.norm } p sum