You have "obscured/complicated" something simple (I think)!

You want to find the maximum mortgage amount, calculated from

the down payment offered: given is down payment amount and 80%.

If down payment = 12,000, then (M = mortgage amount):

12000 = M(1 - 80/100)

.2M = 12000

M = 12000/.2 = 60000

With P = given percentage and D = given down payment, formula is:

M = D / (1 - P/100)