d = int(input()) result = "0." for i in range(1,d+1): result += str(i) print(result.split(".")[1][d-1])