Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    Array.sort compare a;
    let rec loop i acc =
        if i = n then acc else
                if Int a.(i) */ Int acc > Int 1_000_000_000_000_000_000 then -1
                else loop (i + 1) (acc * a.(i))
    in
    loop 1 a.(0) |> Printf.printf "%d\n"
)