c="" for i in range(1,60): c+=str(i) print(c[int(input())-1])