I came up with the following modular identity which looks a bit weird but can be checked numerically for (almost) arbitrary choices of $n$ and $N > n$ when $N = k\,n + r$ with $r < n$. We have $k = \lfloor N/n \rfloor$ and $r = N\%n$.
My claim is that for $n < 2\,r$ it holds that
$$(n-r)\cdot\Big( \lfloor r/(n-r) \rfloor \cdot\big( k + 1\big) + k\Big) + \big(r\%(n-r)\big)\cdot\big( k + 1 \big) = N$$
How do I prove this? Is it trivial or only elementary?