let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  Printf.printf "%d\n" @@
  (fun acc -> if 1000000000000000000 < acc then -1 else acc) @@
  Array.fold_left (fun acc a ->
    if a = 0
    then 0
    else if acc < 0 || (1000000000000000000 + a - 1) / a < acc
    then -1
    else acc * a) 1 as_

