def base10to(n,b): if n//b: return base10to(n//b,b)+str(n%b) return str(n%b) n=int(input()) print(base10to(n,7))