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() s = IO.binread(:eof) |> String.trim |> String.split("\n") p = hd(tl(s)) |> String.split |> Enum.map(&String.to_integer/1) if Enum.member?(p, 0) do 0 else for x <- p, reduce: 1 do acc -> rem(acc * rem(x, 9), 9) end |> then(fn x -> if x == 0, do: 9, else: x end) end |> IO.puts end end