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