n=int(input()) b='' while n:b+=str(n%7);n//=7 print(b[::-1])