Solved mortage problem