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