while True:
try:
n=int(input())
if n <0: break
if n!=0:
print("%o" %(n))
print("\n")
else:
print("0\n")
except:break
while True:
try:
n=int(input())
if n <0: break
if n!=0:
print("%o" %(n))
print("\n")
else:
print("0\n")
except:break
n<0 要記得輸出-1