I am trying to understand the concept of internal energy and it's difference. My textbook said that the difference in internal energy of a system is
$$ \Delta U=Q+W $$ where $Q$ is the heat absorbed or released by system and $W$ is the work done by system to the surrounding or by the surrounding to the system. After that, it mentioned that the signs of $W$ and $Q$ are determined like this:
The work done by surrounding to system: $(+)$. The work done by system to surrounding: $(-)$. Same on heat.
After that general definitions, it started to explain the internal energy differences in various systems like isochoric system, isobaric system. In the section of isobaric system it says that:
If a system were free that can expand against external pressure, when heat is given to that system, it will give some energy by doing some work. So the internal energy difference is:$$ \Delta U=Q_p-W $$ where $Q_p$ is the heat given to a isobaric system.
It is completly OK till the new formula, but isn't the new formula bizarre? Because if we give heat to a system and it will do work. As a result the difference would be like:
$$ \Delta U_{example}=Q_{p_{example}}-(-W_{example}) $$ So, does the work done by system increase its internal energy?