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