a = gets.to_i.times.map{gets.to_r}.sum h = a < 0 ? ?- : "" a = a.abs n, d = a.numerator, a.denominator c = 10**10 n *= c / d puts "#{h}#{n / c}.#{(n % c).to_s.rjust(10, ?0)}"