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