import strutils proc nextString: string = result = "" while not endOfFile stdin: let nextChar = readChar stdin case nextChar of '\r': discard of "\n"[0], ' ': break else: add result, nextChar proc nextInt: int = return parseInt nextString() proc main: void = let D = nextInt() var j = 0 for i in 1..int.high: let ss = $i for s in ss: j += 1 if j == D: s.echo return when isMainModule: main()