N = int(input()) ans = "" while N: N, m = divmod(N, 7) ans += str(m) print(ans[::-1])