Product market competition, R&D, and welfare