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