import math N = int(input()) a = math.floor(N / 7) b = N % 7 B = [b] while a >= 7: b = a % 7 B.append(b) a = math.floor(a / 7) B.append(a) s = "" for i in range(1, len(B)+1): s += str(B[-i]) print(int(s))