N = int(input().strip()) def n7(num): if num == 0: return '' else: return n7(num // 7) + str(num % 7) print(n7(N))