Effect of local structure distortion on superconductivity in Mg- and F-codoped LaOBiS2.