n = gets.to_i def getoi; gets.split.map(&:to_i); end input = getoi ratios = [] input.each_cons(2) {|arr| ratios << Rational(arr[1], arr[0])} puts ratios.reduce(:*)