while True: try: a=int(input()) list1=[] while a>0: list1.append(a%8) a//=8 list1.reverse() for i in range(len(list1)): print(list1[i],end='') print() except EOFError: break