gets; a = gets.split.map(&:to_r) gets; b = gets.split.map(&:to_r) puts (a.reduce(:/) / b.reverse.reduce { |x, y| y / x }).to_s.gsub('/', ' ')