Write a program such that, for every given natural number , prints all the different ways to obtain cents with the euro system of coins (1 cent, 2 cents, 5 cents, 10 cents, 20 cents, and 50 cents).
Input consists of a sequence of natural numbers .
For every , print all the ways to obtain cents, each one in a different line. The numbers of each line must appear in nonincreasing order. The solutions for every must appear in reverse lexicographical order. Print an empty line after the output for each case.
A simple backtracking program that computes the result for every given (even if repeated) is fast enough for this problem.
Input
1 7 2
Output
1 5 2 5 1 1 2 2 2 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1