N = int(input()) a = [] while N > 0: a.append(str(N % 7)) N //= 7 print(''.join(a[::-1]))