n = int(input()) n -= 1 c, b = divmod(n, 9 * 8 // 2) a = 0 while b - (8 - a) >= 0: b -= 8 - a a += 1 a += 1 b += a + 1 ans = str(10 * a + b) + str(b) * c print(ans)