hdu1016 prime ring problem