The position of the center of mass Xcm for a system of particles on the x-axis is given by:
Xcm=m1+m2+m3m1x1+m2x2+m3x3
Given:
m1=300 g, x1=0 cm (at the origin)
m2=500 g, x2=40 cm
m3=400 g, x3=70 cm
Substituting the values:
Xcm=300+500+400300(0)+500(40)+400(70)
Xcm=12000+20000+28000
Xcm=120048000=40 cm