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