n = int(input()) total = 0 i = 1 while True : total += len(str(i)) if n <= total : print(str(i)[len(str(i)) - 1 -(total - n)]) break else : i += 1