I have following system of equations: $q = wz + h + j$, $z = f_k(h+j) + h$
All variables are non-negative integers, and $q$ and $f_k$ are known. The solution of the system is given by: $w = \lfloor \frac qz\rfloor$, $h = z - f_k(q \pmod z)$, $ j = (q \pmod z) -h$.
How to get to this solution? I am not sure.
P.S. By $(q \pmod z)$ I mean by remainder left after dividing q by z, sorry for my bad typing.
$z = f_k(h+j) + h$
So if $h > 0$.
$z > f_k(h+j)$
$z > h+j$
Then use $q = wz + (h + j)$. $h + j < z$, we have
$q \mod z = h + j$ and $w = \lfloor \frac qz\rfloor$
The rest ($h = 0$) is obvious.