d = int(input()) s = '' for i in range(1,60): s += str(i) print(s[d-1])