import sys def solve(): n = int(input()) ans = '' while n > 0: ans = str(n % 7) + ans n //= 7 print(ans) if __name__ == '__main__': solve()