take the cost of fixing add it to the kbb value of a poor condition car. take the value of the car running in good condition which ever is greater is your answer.

ex:
costs 800 to fix
kbb value in poor condition is 1000
1800 total

kbb value in good condition is 2400

2400-1800=600 profit

thats how i do it anyways.