n = int(input()) s = '' while n>0: s = str(n%7) + s n //= 7 print(s)