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