First you find the total, 40, then you find how many large or blue there are, 28 then you divide by the total to be 28/40 or 7/10
Get all the x terms on one side, and the w on the other.
Add 37x on both sides to get 56x+rx=w.
Use the distributive property backwards to get x(56+r)=w.
Divide by 56+r on both sides to get x=w/(56+r)