require 'rational' n = gets.to_i a = gets.chomp.split.map{ |i| Rational(i) } #puts a ans = Rational(1) (n-1).times do |i| ans *= a[i+1]/a[i] end puts ans