def f(N): if N==0: return "0" S="" while N>0: S=str(N%7)+S N//=7 return S N=int(input()) print(f(N))