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