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 a = dp(i-1) * t(i-1)(0) / BigDecimal(t(i)(0))
      val b = dp(i-1) * t(i-1)(1) / BigDecimal(t(i)(1))
      dp(i) = if(a > b) { if(a > a.toLong) a.toLong + 1 else a.toLong }
        else { if(b > b.toLong) b.toLong + 1 else b.toLong }
    })

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