fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    var (tt, aa) = readLine()!!.split(" ").map(String::toLong)
    for (i in 2..n) {
        val (t, a) = readLine()!!.split(" ").map(String::toInt)
        val x = Math.max((tt + t - 1) / t, (aa + a - 1) / a)
        tt = t * x
        aa = a * x
    }
    println(tt + aa)
}
