Solution (source code)

= Solution

The <inclusion-exclusion principle for probabilities> gives
$$
\boxed{\begin{aligned}
P(A\cup B\cup C)={}&P(A)+P(B)+P(C)\\
&-P(A\cap B)-P(A\cap C)-P(B\cap C)\\
&+P(A\cap B\cap C).
\end{aligned}}
$$
Each outcome belonging to two events is initially counted twice and must lose one count. An outcome in all three is counted three times and then subtracted three times, so the last term restores its single count.