import scala.io.StdIn._
object Main{
  def main(args:Array[String]){
    val N = readLine.toInt 
    var ta = readLine.split(' ').map(_.toLong)
    var u = ta(0)
    var v = ta(1)
    for(i <- 0 until N-1){
      ta = readLine.split(' ').map(_.toLong)
      var t = ta(0)
      var a = ta(1)
      if(u > t || v > a){
        val d1 = (u + t - 1l) / t
        val d2 = (v + a - 1l) / a
        val d = d1.max(d2)
        t *= d
        a *= d
      }
      u = t
      v = a
    }
    println(u+v)
  }
}
