I just didn't know the fact that the sums of the heat capacities would equal 0. Is there a specific reason why?
Yes. We makes the assumption that no energy in the form of heat is lost or gained by the system, that it is perfectly insulated. This means the total energy in the form of heat can not change magnitude.
This means for the temperature of one thing to increase, energy must flow into it, the energy has to come from somewhere, the system or the surroundings.
This system is better represented mathematically as:
But that only works for two things, so move them to the same side and you are left with 0; so you can use the same assumption for a total system (system + surroundings) with more then 2 components.