40*g*x + (x/4)*(x/2)*g = 10*(40-x)*g+((40-x)/4)*((40-x)/2)*g, for x