The optimal length of a patent with variable output elasticity and returns to scale in R&D