n = int(input()) r = [] if n==0: r.append(0) while n: r.append(n%7) n //= 7 print(*r[::-1],sep="")