import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    var t = 1L
    var a = 1L

    for (i in 0 until n) {
        val ti = sc.nextInt()
        val ai = sc.nextInt()

        val k = Math.max(1 + (t - 1) / ti, 1 + (a - 1) / ai)
        t = k * ti
        a = k * ai
    }
    println(t + a)
}
