In Dingistan the coins are of the following denomination:

SILVER:

**10, 15, and 20** dingos

COPPER:

** 1, 2, and 3 ** dingos.

The ACMs (automatic change machines) accept silver coins and return change as follows:

**
20d=(15+2+2+1) d**

15d=(10+2+2+1) d

10d=(3+3+2+2) d
After Dingus converted into copper the 145d he had in silver coins, his friend W.G.Ringus counted them and successfully reconstructed the original composition of silver coins, previously unknown to him.

It is up to you to find both the input and the output

- if the Wise Guy did it – you can do it, too.

It is D4, if solved analytically.

10d = 2*3c + 2*2c

15d = 2*3c + 4*2c + 1*1c

20d = 2*3c + 6*2c + 2*1c

So the total number of silver coins can be determined by halving the number of 3c coins.

The maximum number of initial coins is 14, which can only correspond to 1*15d + 13*10d = 28*3c + 30*2c + 1c.

This is certainly one solution, and if there is only one solution, then this is it.

Actually, we know that there is only one solution.

Note that starting with a 10d and 1 20d gives the same change as starting with 2 15d's.

So any starting configuration which has at least 2 15's cannot be distinguished (based on the final change) from at least one other configuration.

Similarly, any starting configuration which has at least 1 10 and 1 20 cannot be distinguished (based on the final change) from at least one other configuration.

The only starting configuration which does not have 2 15*s or at least 1 10d and one 20d of each is obviously 1*15d + 13*10d.

Final answer.