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 yn(b), do: (if b, do: "Yes", else: "No") @mod 10 ** 12 def main do n = ii() ans = f(1, n, 1) IO.puts ans end def f(_, _, 0), do: 0 def f(x, n, t) do cond do x > n -> t true -> f(x+1, n, rem(x*t, @mod)) end end end