let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let ax = read_line () |> split_string ~pattern:" " |> List.map int_of_string

let i = int_of_float 1e18

let rec mul ans = function
  | [] -> Printf.printf "%d\n" @@ if ans > i then (-1) else ans
  | x :: xs -> 
      if x = 0 then print_endline "0"
      else if int_of_float (float i /. float ans) < x then print_endline "-1"
      else mul (ans * x) xs

let () = 
  if List.mem 0 ax then print_endline "0"
  else mul 1 ax