Solving linear congruences