import io.{StdIn => in}

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

  val dp = Array.ofDim[Long](n)
  dp(0) = 1
  (1 until n)
    .foreach(i => {
      val roundUpA = t(i)(0) - 1
      val roundUpB = t(i)(1) - 1
      val a = (dp(i-1) * t(i-1)(0) + roundUpA) / t(i)(0)
      val b = (dp(i-1) * t(i-1)(1) + roundUpB) / t(i)(1)
      dp(i) = math.max(a, b)
    })

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