local n = io.read("*n") if n == 0 then print(0) else local t = {} while 0 < n do table.insert(t, 1, n % 7) n = math.floor(n / 7) end print(table.concat(t)) end