import io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val t = Iterator.continually(in.readLine)
    .take(n)
    .map(_.split(" ").map(_.toInt))
    .toArray

  val dp = Array.ofDim[Int](n)
  dp(0) = 1
  (1 until n)
    .foreach(i => {
      val a = t(i-1)(0).toDouble / t(i)(0)
      val b = t(i-1)(1).toDouble / t(i)(1)
      dp(i) = math.ceil(math.max(a, b) * dp(i-1)).toInt
    })

  val ans = t(n-1).sum * dp(n-1)
  println(ans)
}
