fun main(arg: Array<String>) {
    val N = nextInt()
    val TA = Array(N) { listOfLong() }
    var T = 1L
    var A = 1L
    for ((t, a) in TA) {
        val d = Math.max(T.ceilDiv(t), A.ceilDiv(a))
        T = t * d
        A = a * d
//System.err.println("T:$T A:$A")
    }
    val ans = T + A
    println(ans)
}
fun Long.ceilDiv(n: Long) = (this + n - 1) / n

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
