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;Vector[*gets.split.map(&:to_f)]end n=gets.to_i P=g p((1..n).map{g-P}.combination(3).map{|a,b,c| t=(b-a).outer_product(c-a) a.inner_product(t).abs/t.norm }.inject(:+))