import sys
n=int(sys.stdin.readline().strip())
s=''
for i in range(1,n+1):
    s+=str(i)
print(s[n-1])