let () = Scanf.scanf "%d\n" @@ fun k ->
  let as_ = Array.init k @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  Array.fold_right (fun a (minimum, maximum) ->
    (minimum + a - 1 - (minimum + a - 1) mod a, maximum + a - 1 - maximum mod a)) as_ (2, 2)
  |> (fun (minimum, maximum) ->
      if maximum < minimum then print_endline "-1"
      else Printf.printf "%d %d\n" minimum maximum)

