Then you should find expressions for $l$ and $\cos\phi$ in terms of h, and put those into the formula for I. Then differentiate to find the value of h that maximises I.