N = int(input()) A = [] for a in range(1,9): for b in range(a+1,10): A.append(10*a + b) qu = N//len(A) rem = N%len(A) if rem == 0: qu -= 1 tail = str(A[rem-1])[-1] ans = str(A[rem-1]) + tail*qu print(ans)