Modular Path Queries with Arithmetic (Logical Methods in Computer Science, 2021)