let reader (s:string) = match String.length s with | i when i > 2 -> 50 | _ -> int s let factorial n = if n >= 50 then bigint.Zero else seq { 1..n } |> Seq.map bigint |> Seq.reduce (*) let fmt (n:bigint) = if n = bigint.Zero then "000000000000" else let s = string n match String.length s with | i when i > 12 -> s.[i-12..i-1] | _ -> s let calc = reader >> factorial >> fmt stdin.ReadLine () |> calc |> printfn "%s"