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