Because there is the same amount of water in each sample, the samples have an equal amount of influence over the overall temperature. that means it will be somewhere right in the middle of the two original temperatures. The middle, also the average, of the two samples' temperatures is 30c, meaning that if you combined the 20c water and the 40c water the final result would be 100g of 30c water. If you need some more explanation, just ask.