open Microsoft.FSharp.Core.Operators.Checked

let bOverNum = 1000000000000000000L

/// 既定の値を超えたら true
let checkOverFlow (x: int64) (y: int64) =
    try
        x * y < 0L
    with
    | :? System.OverflowException -> true
    | _ -> true

let rec fb (x: int64) (xs: int64 list) =
    if List.contains 0L xs then
        0L
    else
        match xs with
        | y :: ys -> if checkOverFlow x y then -1L else fb (x * y) ys
        | [] -> x

stdin.ReadLine() |> ignore
stdin.ReadLine().Split(' ')
|> Array.map (int64 >> List.ofArray >> fb 1L) |> printfn "%A"
