I've been trying to evaluate the sum
$$\sum_{k=0}^\infty \frac{m^k\bmod n}{m^k}$$
where $m$ and $n$ are positive integers greater than $1$ and $a\bmod b$ is the remainder when $a$ is divided by $b$. This came up in a combinatorics problem I was doing, and I know how to evaluate it given $m$ and $n$ (the numerators repeat, so it ends up just being geometric), but I'm not sure how to evaluate it generally.
Any ideas?