object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val ta = List.fill(n)((sc.nextInt(), sc.nextInt()))
  var tNow = 1L
  var aNow = 1L
  for ((t, a) <- ta) {
    val tf = (tNow+t-1) / t
    val af = (aNow+a-1) / a
    tNow = t * tf.max(af)
    aNow = a * tf.max(af)
  }

  println(tNow + aNow)
}
