D = int(input()) C10 = "" for i in range(D+1): C10 += str(i) print(C10[D])