defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def main do _n = ii() p = li() if Enum.member?(p, 0) do 0 else for x <- p, reduce: 1 do acc -> rem(acc * x, 9) end |> then(fn x -> if x == 0, do: 9, else: x end) end |> IO.puts end end