m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6] N = int(input()) ans = '' while N >= 2: for i, t in enumerate(reversed(m)): if N >= t: N -= t ans += str(9 - i) print(ans)