The total cost C is the sum C = 505+50 - so, calculate it first. Then the profit is the revenue 1118 minus total cost C. Do it as instructed.