defmodule Main do

  def main do
    IO.gets("")
    list = IO.gets("") |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1)

    list |> multiplication() |> IO.puts
  end

  @doc """
  Multiplication

  ## Examples

      iex> Multiplication2.multiplication([1000000000, 1000000000])
      1000000000000000000
      iex> Multiplication2.multiplication([101, 9901, 999999000001])
      -1
      iex> Multiplication2.multiplication([4, 1, 5, 0])
      0

  """
  def multiplication(list) do
    list
    |> Enum.reduce(1, fn n, acc -> acc * n end)
    |> value()
  end

  defp value(n) when n > 1000000000000000000, do: -1
  defp value(n), do: n
end