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