George is getting tired of the decimal number system.  He intends to switch and use the septenary (base 7) number system for his future needs.  Write a program to help George start his transformation into the septenary number system by taking in a list of decimal numbers and print out the corresponding septenary number.
 

Input
A list of numbers in decimal format ending with -1.

Output
A list of numbers in septenary.
 

Example
Input:
1 2 88 42 99 -1

Output:
1 2 154 60 201
#*+++++++++++++++++++++
# * Written By --------
# * Boddapati Mahesh  **
# * IIIT Hyderabad *****
# */

import sys 
x=map(int,raw_input().split())
l=[]
for i in range(0,len(x)):
        if(x[i]!=-1):
            while(x[i]!=0):
                l.append(x[i]%7)
                x[i]/=7
        for j in range(len(l)-1,-1,-1):
            sys.stdout.write(str(l[j]))
        l=[]
        if(i!=len(x)-1):
            sys.stdout.write(" ")
print