Write a program that, given four natural numbers n, x, y and t, prints all the multisets with t numbers that can be made up with {1, …, n}, in such a way that every number appears between x and y times.
Input
Input consists of a natural number n > 0, followed by a natural number x ≥ 0, followed by a natural number y > x, followed by a natural number t ≥ 0. Assume nx ≤ t ≤ ny.
Output
Print all the multisets of size t that can be made up with {1, …, n}, using each number between x and y times. The numbers inside each multiset must appear in non-decreasing order.
You can print the solutions to this exercise in any order.
Input
3 1 4 6
Output
{1,2,3,3,3,3} {1,2,2,3,3,3} {1,2,2,2,3,3} {1,2,2,2,2,3} {1,1,2,3,3,3} {1,1,2,2,3,3} {1,1,2,2,2,3} {1,1,1,2,3,3} {1,1,1,2,2,3} {1,1,1,1,2,3}