fun main(args: Array<String>) {
  val N = readLine()!!.toInt()
  var t: Long = 1
  var a: Long = 1
  for(i in 1..N){
    val (T,A) = readLine()!!.split(" ").map(String::toInt)
    val k = max((t+T-1)/T, (a+A-1)/A)
    t = T*k
    a = A*k
  }
  println(t+a)
}
fun <T: Comparable<T>>max(x: T, y: T): T{
  return if(x>=y) x else y
}