Solution (source code)

= Solution

The global <Gauss-Bonnet theorem> for the induced <Riemannian metric> is
$$
\boxed{\int_X K\,dA=2\pi\chi(X).}
$$
Here $K$ is the <Gaussian curvature>, $dA$ the induced surface-area element, and $\chi(X)$ the <Euler characteristic>. For a connected orientable compact surface of <genus> $g$, $\chi(X)=2-2g$. For several components, sum their contributions. There is no boundary-curvature term because $X$ has no boundary.