Solution (source code)

= Solution

For a compact oriented <regular surface> $S\subset\mathbb R^3$ without boundary, the <Gauss-Bonnet theorem> states
$$
\int_S K\,dA=2\pi\chi(S).
$$
Here $K=k_1k_2$ is the <Gaussian curvature>, the product of the two <principal curvatures>; $dA$ is the area element induced by the <first fundamental form>; and $\chi(S)$ is the <Euler characteristic>. If $S$ is connected and has <genus> $g$, the <classification theorem for surfaces> gives $\chi(S)=2-2g$, so
$$
\boxed{\int_S K\,dA=4\pi(1-g).}
$$