The formula to calculate the total (amount of involved money, ambigious) is:
All the money you owe to person 1 + all the money you owe to person 2 = 150 + 100 = 150
However, the question assumes that the formula to calculate the total amount of involved money is:
Part of the money you owe to person 1 + all of the money you owe to person 2 + chocolates = 70 + 20 + 20 = 140
The formula presented by the question is bogus.