A company produces gadgets, and the cost to produce \( x \) gadgets is given by the linear function \( C(x) = 4x + 50 \), where \( C(x) \) is the total cost in dollars. The revenue generated by selling \( x \) gadgets is given by the linear function \( R(x) = 7x - 10 \), where \( R(x) \) is the total revenue in dollars. Determine the profit function \( P(x) \), which is the difference between revenue and cost. Then, find the profit when 20 gadgets are produced and sold. Let's think step by step and output the final answer within \boxed{}.
user