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 p |> Enum.map(&loli/1) |> Enum.sum() |> loli end def loli(n) do s = n |> to_string cond do s |> String.length() == 1 -> n true -> s |> String.split("", trim: true) |> Enum.map(&String.to_integer/1) |> Enum.sum() |> loli end end end