defmodule Main do
  def main do
    IO.gets("") |> String.trim() |> String.to_integer()

    max = 1_000_000_000_000_000_000

    arr_result =
      IO.gets("")
      |> String.split()
      |> Enum.map(&String.to_integer/1)
      |> list_multi()

    cond do
      arr_result > max ->
        IO.puts(-1)

      true ->
        IO.puts(arr_result)
    end
  end

  def list_multi([first | []]) do
    first
  end

  def list_multi([first | rest]) do
    first * list_multi(rest)
  end
end