X = [] for a in range(1, 10): for b in range(a+1, 10): X.append((a, b)) n = int(input()) q, r = divmod(n-1, 36) i = 0 a, b = X[r] ans = a * pow(10, q+1) for i in range(q+1): ans += b * pow(10, i) print(ans)