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