Amount of heat developed in capacitors
An ideal capacitor has no resistance and therefore no heat will be dissipated by the capacitors in your circuit.  The only place in that circuit (assuming all ideal parts) that electrical energy will be converted to heat is the resistor, so what you need to find is the power dissipated by the resistor, which involves the charges stored in the capacitors as well as the voltage sources E1 and E2.

Naturally, real parts have what is called an ESR (equivalent series resistance) but based on the way this question is phrased, it seems we are looking at a theoretical rather than actual circuit.

The work done is the change in energy, \$W = E_f - E_0\$.  The initial energy is stored in \$C_1\$ and is \$\displaystyle E_0 = \frac{1}{2}\frac{Q^2}{C_1}\$. The final energy is \$\displaystyle E_f = \frac{1}{2}C_tV^2\$ where \$\displaystyle C_t = \frac{1}{\frac{1}{C_1}+\frac{1}{C_2}}\$.  Putting it all together we get
$$
W = \frac{1}{2}\left(\frac{1}{\frac{1}{C_1}+\frac{1}{C_2}}V^2 - \frac{Q^2}{C_1}\right)
$$
If you plug in the numbers with \$V=8\text{V}\$ and \$Q=10\mu\text{J}\$, you should get \$16.67\mu \text{J}\$.