This is about a market with perfect competition. The number of firms in the market is 1,000. They all have the same cost structure, which is depicted in the figure below. ATC stands for ‘average total costs’, AVC for ‘average variable costs’ and MC for ‘marginal costs’. The total cost function is: TC(q) = (2/3)q3 – 2q2 + 5q + 18, where q is the output of that firm. In the second figure, market demand is depicted. The inverse demand function is
P(Q) = 29 – (1/500)Q, where Q is the total industry output on the market.

How can I calculate the exact quantity and price in the long run equilibrium? By setting MC=ATC? And how is the calculation step by step (sorry Im so bad at maths)? Or is there a better/easier way?