def ascan;gets.split.map(&:to_i);end gets; zz = ascan puts zz.reduce([1,zz[0]]){|s,e| [s[0]*Rational(e,s[1]),e]}[0]