S = '' for s in range(1, 56): S += str(s) print(S[int(input())-1])