n=int(input()) ans=[] while True: ans.append(n%7) n=n//7 if n<7: ans.append(n) break ans.reverse() print(*ans,sep='')