let () =
  Scanf.scanf "%d" @@ fun k ->
  let a = Array.init k (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let l, u = Array.fold_right (fun x (l, u) ->
    (l+x-1)/x*x, u/x*x + x-1
  ) a (2, 2) in
  if l > u then print_endline "-1" else Printf.printf "%d %d\n" l u