Elastic scattering of mesoatoms on hydrogen and on deuterium: Determination of the total spin state of the μp mesoatom