Solution (source code)

= Solution

Take zero <electric potential> at infinity and put $K=(4\pi\varepsilon_0)^{-1}$. By <spherical symmetry> and <Gauss's law>, the <electric field> is radial, with magnitude determined by the total enclosed <electric charge>. Thus, away from the idealized shell surfaces,
$$
\boxed{\mathbf E(r)=Kq\begin{cases}
0,&0\le r<a,\\
\mathbf e_r/r^2,&a<r<b,\\
-\mathbf e_r/r^2,&b<r<c,\\
2\mathbf e_r/r^2,&r>c.
\end{cases}}
$$
Integrating $E_r=-d\Phi/dr$ from infinity, or adding the three spherical-shell potentials, gives
$$
\boxed{\Phi(r)=Kq\begin{cases}
a^{-1}-2b^{-1}+3c^{-1},&r\le a,\\
r^{-1}-2b^{-1}+3c^{-1},&a\le r\le b,\\
-r^{-1}+3c^{-1},&b\le r\le c,\\
2r^{-1},&r\ge c.
\end{cases}}
$$
The expressions agree at each interface, so the potential is continuous everywhere, including the origin. The <electric field> has different interior and exterior limits at each infinitely thin charged surface, with jump equal to <surface charge density> divided by $\varepsilon_0$. An ideal sheet has no single classical field value on the sheet itself; the displayed adjacent limits specify the field there. In conducting material of nonzero thickness the internal field is zero.

The <electrostatic energy> is the <integral> of $\varepsilon_0|\mathbf E|^2/2$. There is no contribution from $r<a$, and spherical integration gives
$$
U=\frac{q^2}{8\pi\varepsilon_0}\left[\int_a^b\frac{dr}{r^2}+\int_b^c\frac{dr}{r^2}+4\int_c^\infty\frac{dr}{r^2}\right]
=\boxed{\frac{q^2}{8\pi\varepsilon_0}\left(\frac1a+\frac3c\right).}
$$
The dependence on $b$ cancels because the magnitude of enclosed <electric charge> is $|q|$ on both sides of the middle shell, even though the field direction changes.