N = int(input()) ans = [] while N: ans.append(N%7) N //= 7 ans.reverse() print(*ans, sep="")