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