n = int(input())
S = ""
i = 1
while len(S) < n:
    S += str(i)
    i += 1

print(S[n-1])

需要自己创建逐项加一的S