Effects of the radial inflow of gas and galactic fountains on the chemical evolution of M 31