Car buying

I have just purchased (at time 0) a new car for $12,000. The cost of mainting a car during a year depends on the age of the car at the beginning o the year, as given below. To avoid the high maintenance costs associated with an older car, I may trade in my car and purchase a new car. The price I receive on a trade-in depends on the age of the car the time of trade-in. Assume it always costs $12,000 to purchase a new car, My goal is to minimize the net cost (purchasing costs + maintenance costs - money received in trade ins) during the next 5 years.
Age Maintenance cost Trade-in Price
0 $2000 $7000
1 $4000 $6000
2 $5000 $2000
3 $9000 $1000
4 $12000 $0