print("".join(map(str,range(56)))[int(input())])