N=int(input()) ls=[] while True: if N<7: ls.append(N) break Nm=N%7 ls.append(Nm) N=N//7 ls.reverse() for i in ls: print(i,end="")