Solution (source code)

= Solution
{c}

In a <semi-additive category>, hom-sets are <commutative monoids> and composition is additive in both variables. Write $S=\coprod_iA_i$, $P=\prod_iA_i$, with injections $\nu_i$ and projections $\pi_i$. The canonical $c:S\to P$ has $\pi_ic\nu_j=1_{A_i}$ when $i=j$ and zero otherwise. Define
$$
d=\sum_{i=1}^n\nu_i\pi_i:P\to S.
$$
Bilinearity gives
$$
\pi_kcd=\sum_i(\pi_kc\nu_i)\pi_i=\pi_k,\qquad
dc\nu_j=\sum_i\nu_i(\pi_ic\nu_j)=\nu_j.
$$
The universal properties of the <product in a category> and <coproduct in a category> imply $cd=1_P$ and $dc=1_S$. For the empty family, $S$ is initial and $P$ terminal. Their endomorphisms are necessarily the identity and the zero morphism; the zero map $P\to S$ therefore also gives inverse composites. Thus the comparison is an isomorphism for every finite family, giving a <biproduct>:
$$
\boxed{c^{-1}=\sum_{i=1}^n\nu_i\pi_i.}
$$