Hydrogen behavior in Mg^+-implanted graphite