defmodule Main do @mask 1_000_000_000_000 def main do IO.read(:line) |> String.trim() |> String.to_integer() |> solve |> IO.puts() end def solve(n) do cond do n < 60 -> solve_rec(n, 1, false) :else -> "000000000000" end end def solve_rec(1, r, pad) do cond do pad -> r |> to_string |> String.pad_leading(12, "0") :else -> r end end def solve_rec(n, r, pad) do tmp = n * r a = tmp |> div(@mask) cond do a == 0 -> solve_rec(n - 1, tmp, pad || false) :else -> solve_rec(n - 1, tmp - a * @mask, true) end end end