n = int(input()) # Calculate the length L of the ushippoi number L = 2 + (n - 1) // 36 # Determine the position within the group of length L pos = (n - 1) % 36 + 1 remaining = pos a = 1 b = 2 # Find the correct a and b for the given position for a_candidate in range(1, 9): count = 9 - a_candidate if remaining <= count: b = a_candidate + remaining a = a_candidate break remaining -= count # Construct the result string result = str(a) + str(b) * (L - 1) print(result)