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