from collections import deque n = int(input()) q = deque([i for i in range(10, 100) if int(str(i)[0]) < int(str(i)[1])]) res = [] while q and len(res) < n: x = q.popleft() res.append(x) y = int(str(x)+str(x)[-1]) q.append(y) print(res[-1])