Interaction of solar and galactic cosmic-ray particles with the Moon