open System let No500 () = let N = Numerics.BigInteger.Parse <| Console.ReadLine() let rec fac (n : Numerics.BigInteger) (f : Numerics.BigInteger) = if n = (Numerics.BigInteger.Parse "1") then f else fac (n - (Numerics.BigInteger.Parse "1")) (f * n) let ans = fac N (Numerics.BigInteger.Parse "1") let ans = ans % Numerics.BigInteger.Parse "1000000000000" printfn "%A" ans () No500 ()