import java.util.Arrays

const val MOD: Long = (1e9+7).toLong()

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var mint = 0L
    var mina = 0L
    for (i in 0..n-1) {
        val (t, a) = readLine()!!.split(" ").map{it.toInt()}
        val m = arrayOf((mint + t - 1) / t, (mina + a - 1) / a, 1L).max()!!
        mint = t * m
        mina = a * m
    }

    println(mina + mint)
}
