You should be able to solve these problems using our recipe (and Mathematica if needed) for optimization with equality constraints. Try it and check if your solution coincides with the solution presented here.
Consider a maximization problem with inequality constraints where the objective function depends on some exogenous variables $\mathbf c$ and $\boldsymbol\theta$. $$V(\mathbf c,\boldsymbol\theta)=\max\limits_{\substack{\mathbf x\\ \mathrm{subject\, to} \\ \\g_1(\mathbf x)\le c_1\\[-6pt] \vdots \\[1.5pt] g_k(\mathbf x)\le c_k }} f(\mathbf x,\boldsymbol\theta).$$ Let $V(\mathbf c,\boldsymbol\theta)$ be the corresponding value function of the optimization problem and let $x^\ast$ be the solution (notice that the solution also depends on the $\boldsymbol\theta$ parameter). The envelope theorem states that: