n = int(input())
k = 0
S = ''
while len(S)<=n:
    S +=str(k)
    k = k+1
print(S[n])