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