Q, R = divmod(int(input()) - 1, 36) for i in range(1, 9): for j in range(i + 1, 10): if not R: exit(print(str(i) + str(j) * (Q + 1))) R -= 1