The total-cost, C(x), and total-revenue, R(x), functions for producing x items are shown below, where 0 ≤ x ≤ 1000.
C(x) = 5800 + 500x and R(x) = -1/2x^2 + 1100x
a) Find the total-profit function P(x).
b) Find the number of items, x, for which the total profit is a maximum.