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