n = int(input()) ans = "" while not n == 0: ans += str(n%7) n = n//7 if ans == "": print(0) else: print(ans[::-1])