open System open System.Text let solve n = match n with | 0 -> "0" | _ -> let loop = "142857" let loopLen = loop.Length let builder = StringBuilder("0.") let rec f (builder: StringBuilder) n = match n with | 0 -> builder | n -> f (builder.Append(loop)) (n-1) (f builder (n / loopLen)).Append(loop.Substring(0, (n % loopLen))).ToString() let N = Console.ReadLine() |> int solve N |> Console.WriteLine