d = int(input()) s = "" for i in range(60): s += str(i) print(int(s[d]))