#yuki499 def f(n,m): s="" while n>0: a=n%m s+=str(a) n/=m return s[::-1] n=int(raw_input()) print f(n,7)