N = int(input()) digit = [] while True: N, r = divmod(N, 7) digit.append(r) if N == 0: break print(''.join(map(str, reversed(digit))))