Constraint solving on modular integers