defmodule Main do def main do IO.read(:line) IO.read(:line) |> String.trim() |> String.split() |> Enum.map(&String.to_integer/1) |> solve() |> IO.puts() end def solve(p) do q = p |> Enum.map(&loli/1) cond do 0 in q -> 0 true -> q |> Enum.sum() |> loli end end def loli(n) do case n do 0 -> 0 _ -> case n |> rem(9) do 0 -> 9 _ -> n |> rem(9) end end end end