print((function (n) if n==0 then return n end local s="" while (n>0) do n,s=math.floor(n/7),tostring(n%7)..s end return s end)(io.stdin:read("*n")))