let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let tas = Array.init n (fun _ -> Scanf.scanf "%d %d\n" (fun t a -> t, a)) in
  Array.fold_left (fun (x, y) (t, a) ->
    let n = max ((x + t - 1) / t) ((y + a - 1) / a) in
    (t * n, a * n)) (1, 1) tas
  |> (fun (x, y) -> x + y)
  |> Printf.printf "%d\n"