D=int(input()) C=[] for i in range(56): C+=str(i) C="".join(C) print(C[D])