d = int(input()) for i in range(d): for s in str(i+1): d -= 1 if d == 0: print(s) break; else: continue; break