n = int(input()) ans = "" while n: q = n % 7 n = n // 7 ans = str(q) + ans print(ans)