modular arithmetic can be useful too