let mass 4m be Z
F=G(m1*(Z-m1)/d^2
Using calculus...
dF/dm1=0=G(Z-m1)/d^2 -m1/d^2)
solving for m1,
Z-m1-m1=0
m1=Z/2
So split into 2m, and2m.
Now if you don't know the wonderful world of calculus, then plot the following parabola, and see where it is max:
F=G(m1*(Z-m1)/d^2
k=Z(m1)-(m1)^2