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 f(x) do if x == 0 do 0 else case rem(x, 9) do 0 -> 9 n -> n end end end def main do n = ii() IO.puts f(n) end end