Just remember that
1. A call option is worth St - X when positive, and put is X - St.
2. If you sold the option, add the premium to the profit.
Based on these, calculate the profit for a butterfly spread, for example.
Initially, you bought a call (-cL), sold two calls (+2cM), and bought a call (-cH). So your profit is
max(0,St-XL) - 2max(0,St-XM) + max(0,St-XH) - cL + 2cM - cH.
If you remember the shape of the graph - profit is max when St = Xm so max profit =
XM -XL - 2*0 + 0 - cL + 2cM - cH.
(I hope these are right, I don’t have acess to the text right now.)