We use 1/o + 1/i = 1/f where o is the distance of the object, i as distance of the image and f is the focal length.
Substituting, 1/ 100 + 1 / i = - 1 /25
i = - 20 cm
For the case of the problem,
o = (20 + 30) = 50 cm
f = 33.33. Using 1 / i + 1 / o = 1/f , i = 100 cm
M = magnification = - i / o
m1 = -(-20)/100 = 20/100 = 0.2
m2 = -100/50 = -2
M = m1*m2 = -2 x 0.2 = -0.4.