n=int(input()) ans=[] num="" while n!=0: ans.append(n%7) n//=7 ans_2=ans[::-1] for i in range(len(ans)): num+=str(ans_2[i]) print(num)