N=int(input()) Se=7 i=0 while N>Se: Se*=7 Se//=7 Ns=[] if N==0: print (0) else: while N>=1: Ns.append(N//Se) # print (Se) N%=Se Se//=7 Nst=[str(i) for i in Ns] Nj="".join(Nst) print (Nj)