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