In a perfectly competitive market, a firm operates where marginal cost (MC) equals marginal revenue (MR) to maximize profit. Consider a firm that produces widgets. The following cost function describes the firm's production costs:
C(q) = 50 + 10q + q2, where C is total cost and q is the quantity of widgets produced. Assuming the price (P) at which the firm sells its widgets is constant at $30, determine the output level (q) at which the firm maximizes its profit.