A manufacturer finds it costs him x^2+5x+7 dollars to produce x tons of an item. At production levels above 3 tons, he must hire additional worker, and his costs increase by 3(x-3) dollars on his total production. If the price he receives is $13 per ton regardless of how much he manufactures and if he has a plant capacity of 10 tons, what level of output maximizes profits?

This is a Calc AB problem that I need help figuring out. Thanks