The moments to the left of the pivot must be equal to the moments on the right. Let d represent the distance of each mass from the pivot, which is at the 50 cm mark.
md₁ + md₂ = md₃ + md₄
m cancels out from both sides,
d₁ + d₂ - d₃ = d₄
(50 - 27) + (50 - 38) - (99 - 50) = d₄
d₄ = -14
That means the mass should be placed 14 cm to the left of the pivot, at the 36 cm mark.