solve for the indicated variable w=mg (m)
w=mg
Divide both sides by g to isolate the m
w/g=m/g
That is your answer
m=w/g