l = [str(i) for i in range(56)] l = ''.join(l) print(l[int(input())])