import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(read()) A = [] while N: N,r = divmod(N,7) A.append(r) print(''.join(map(str,A[::-1])))