Magnetic order and evolution of the electronic state aroundx=0.12 in La2−xBaxCuO4 and La2−xSrxCuO4