n = int(input()) keta = n // 36 + 2 n = n % 36 cnt = 0 for i in range(1, 10): for j in range(i + 1, 10): if i != j: cnt += 1 if cnt == n: ans = (i, j) print(str(ans[0]) + str(ans[1]) * (keta - 1))