1st can you do this with \$24?
$2\times 5 + 2 \times 7 = 24$, so yes you can.
Suppose you can do it with \$D. Show you can do it with \$(D+1).
$D = 5m+7k,~~m,k \in \mathbb{N}$
$D+1 = 5m + 7k + 1 = \dots$
you should be able to finish from here.
There are a couple different ways of obtaining D+1 and you'll need to use both of them.
I would use five base cases:
For any , you can write for some nonnegative integer . It can only be written as one of them. Depending on how it can be written, you use the appropriate breakdown of the base number, then add $\$5$ notes.