A dynamic model of R&D competition