John adopts a dog from a shelter.  The dog ends up having health problems and this requires 3 vet appointments,  which cost $400 each.  After the first appointment, John paid $100 for pet insurance that covers 80% of the subsequent visits.  How much did he pay in total?
He got a discount of 400*.8=$
<gadget id="calculator">400*.8</gadget>
<output>320</output>
320.
He got that discount for 3-1=
<gadget id="calculator">3-1</gadget>
<output>2</output>
2 visits.
So each of those visits cost 400-320=$
<gadget id="calculator">400-320</gadget>
<output>80</output>
80.
So he paid 2*80=$
<gadget id="calculator">2*80</gadget>
<output>160</output>
160 for those visits.
That means he paid a total of 400+160+100=$
<gadget id="calculator">400+160+100</gadget>
<output>660</output>
660.

<result>660</result>