n = int(input()) l = [] x = n while n >= 7: x = n // 7 y = n % 7 l.append(y) n = n // 7 print(str(x) + ''.join(map(str,l[::-1])))