We are given the following integers $a\geq1,b\geq1$ and $c\geq1$.
I am standing on a real line at point $b$. I always can move right by $b$ points or move left by $a$ points. I want to find out if I can reach point $c$.
So we need to find if there exist integers $n1,n2$ such that $c-b=bn_1-an_2$.
This problem is from coding, but I couldn't find a necessary and sufficient condition to check whether we can reach the point $c$ from point $b$. I feel that we need to play with $\mathrm{mod}(b)$, $\mathrm{mod}(a)$, $\mathrm{mod}(b-a)$.