fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  var ta = Array(n) { readLine()!!.split(" ").map { it.toLong() } }
  var (nt, na) = ta[0]
  for (i in 1 until n) {
    val (t, a) = ta[i]
    val k = arrayOf((nt + t - 1) / t, (na + a - 1) / a).max()!!
    nt = k * t
    na = k * a
  }
  println(nt + na)
}
