Origins of knowledge and innovation in R&D alliances: a contingency approach