N = int(input()) l = [] while N: r = N % 7 l.append(str(r)) N //= 7 print("".join(reversed(l)))