Solution of the Riemann problem for an ideal polytropic dusty gas in magnetogasdynamics