Endogenous production of R&D and stable economic development