import heapq n = int(input()) # Generate all valid (a, b) pairs where a < b pairs = [] for a in range(1, 10): for b in range(a + 1, 10): pairs.append((a, b)) # Initialize the heap with the initial elements (c=0) heap = [] for a, b in pairs: heapq.heappush(heap, (2, a, b, 0)) # (length, a, b, c) current_step = 0 result = None while heap: length, a, b, c = heapq.heappop(heap) current_step += 1 if current_step == n: # Construct the result string result = str(a) + str(b) + str(b) * c break # Push the next element in this (a, b) sequence new_length = length + 1 heapq.heappush(heap, (new_length, a, b, c + 1)) print(result)