Arithmetic progression topology
Hint: Try $d = \operatorname{lcm}(b,b')$ or $d = bb'$ - either should work fine. The idea being that we're looking for things that are in a list of step size of $b$ (so to say) and in another list of step size $b'$.
Hint: Chinese Remainder Theorem.
If $\rm x\equiv a\bmod b,\bar{a}\bmod\bar{b}$, then pick $\rm d:=lcm(b,\bar{b})$ and $\rm c$ a residue of $\rm x$ mod $\rm d$.