N = int(input()) t = '' while N != 0: t += str(N % 7) N //= 7 print(t[::-1])