let solve (mt, ma) (t, a) =
    let tm = (mt + t - 1) / t
    let am = (ma + a - 1) / a
    let m = max tm am
    (t * m, a * m)
     
let doIt () =
    let n = stdin.ReadLine  () |> int
     
    let taSeq =
        seq { for i in 1..n do
                let t, a =
                    stdin.ReadLine () |>
                    (fun line -> line.Split()) |>
                    (fun arr -> (int arr.[0], int arr.[1]))
                yield (t, a) }
     
    Seq.fold solve (1, 1) taSeq |>
    (fun (t, a) -> t + a) |>
    printfn "%d"