let f () = let rec iter n (sb:System.Text.StringBuilder) = if n>0 then sb.Insert(0,n%7); iter (n/7) sb else sb.ToString() match stdin.ReadLine() with | "0" -> "0" | n -> iter (int n) (new System.Text.StringBuilder()) f () |> printfn "%s"