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