ans = [] for a in range(1, 10): for b in range(a+1, 10): x = 10 * a + b ans.append(x) ans.sort() n = int(input()) c = (n-1) // 36 n %= 36 if n == 0: n = 36 res = ans[n-1] res = str(res) + str(res)[-1] * c print(res)