N = int(input()) if N == 0: print(0) quit() ans = "" while N > 0: N, r = divmod(N, 7) ans = str(r) + ans print(ans)