s = ''.join(map(str, range(56))) d = int(input()) print(s[d])