We have three vessels with integer volumes a, b, c (numbers a, b, c are not greater than 10) in which the volume x, y, of water is at the beginning, in this order.
We can pour water from container to container, always by completely filling the container where we pour, or by completely emptying the container from where we pour. The volume of water poured is determined by which of these variants occurs earlier.
We must not pour water anywhere else or add it from any other source.
The inputs of the program are the numbers a, b, c, x, y, z, indicating the volumes and initial contents of the vessels.
The program prints a list of all volumes (including zero, if possible) that can be achieved by pouring (the entire volume of water in any of the vessels) and for each of them states after the colon the minimum number of required overflows. The volumes in this list will be printed in ascending order.
Example:
Input:
4 1 1 1 1 1
Corresponding output:
0: 1 1: 0 2: 1 3: 2