Substitution and Complementarity in Endogenous Innovation