Comments

Why does the solution have to be mod a_1? If an arbitrary modulus larger than a_1 were chosen, what would change about the solution? Is choosing the mod to be a_1 only to prevent TLE or is there another reason for it?