open Scanf
open Printf

let multiplication lst =
  let rec loop total l = match l with
      [] -> total
    | first :: rest -> if float total > float 1_000_000_000_000_000_000 then -1
                       else loop (first * total) rest
  in loop 1 lst

let n = sscanf (read_line ()) "%d" (fun n -> n)
let a_list = List.map (fun n -> int_of_string n) (String.split_on_char ' ' (read_line ()))
let () = printf "%d\n" (multiplication a_list)
