def main(): N = int(input()) N -= 1 nums = [] for i in range(1, 10): for j in range(i+1, 10): nums.append(i * 10 + j) P = N % 36 cost = N // 36 mozi = str(nums[P]) print(mozi + mozi[-1] * cost) if __name__ == '__main__': main()