n = int(input()) ans = "" while n >= 1: ans += n % 7 n //= 7 print(ans[::-1])