The amount you have at the beginning is $b$.
After $1$ year, you have $a+b(1+c)$.
After $2$ years, you have $a+(a+b(1+c))(1+c)$.
After $3$ years, you have $a+(a+(a+b(1+c))(1+c))(1+c)$.
etc.
After $N$ years, you have
$$b(1+c)^N+a(1+c)^{N-1}+a(1+c)^{N-2}+\cdots+a(1+c)+a$$
$$=\left(b+\frac{a}{c}\right)(1+c)^N-\frac{a}{c}$$
For a given $d$, in general you can't have integer $N$ which gives you the exact amount $d$. But you have find the integer $N$ that you amount first exceed $d$, by
$$N=\bigg\lceil \frac{\log\frac{d+a/c}{b+a/c}}{\log(1+c)} \bigg\rceil $$
If we are allowed to approximate it as a continuous time process, then we have
$$\frac{dM}{dx}=a+cM$$
where $M$ is the amount of money you have at $x$.
The solution is
$$M=\left(b+\frac{a}{c}\right)e^{cx}-\frac{a}{c}$$
Then you can solve
$$\left(b+\frac{a}{c}\right)e^{cx}-\frac{a}{c}=d$$
to obtain
$$x=\frac{1}{c}\ln\frac{d+a/c}{b+a/c}$$