Principal amount = $345,500
Monthly payment = $878.85
Period of payment = 40 years
Interest rate = 3%
Since monthly payment is given, the first part question asks the total amount to be paid after 40 years.
That is;
Total cost of principal amount = monthly payment*40*12 = 878.85*40*12 = $421,848
Total interest paid = Total amount paid - Principal amount = $421,848 - $345,500 = $76,348