n = int(input())
ans = ""

while n // 7:
    q = n % 7
    n = n // 7
    ans = str(q) + ans

print(str(n % 7)+ans)