To strengthen Socrates, the mother of Socrates Papastopoulos prepares him a glass of…
- User
To strengthen Socrates, the mother of Socrates Papastopoulos prepares him a glass of pasteurized milk every day. Socrates 3 glasses with capacities A , B , c It has A, B, C, each of which are numbers in the range of 1 to 20. Socrates' mother every day a glass with capacity c He fills C with milk, but since Socrates is playful, he may keep pouring the milk from one glass to another!
But since Socrates loves milk, he does not spill any amount on the ground in this process of transferring milk, and in fact, he does the act of pouring milk from one glass to another as long as the destination glass holds. On the other hand, out of curiosity! If the destination glass has more capacity than the source glass, it must empty all the milk into the destination glass so that there is no milk left in the source glass.
Write a program so that the mother of Socrates Papastopoulos knows how much milk can be in a glass with this Socrates' game (pouring milk from one glass to another) c C exists after each movement while the glass with capacity A A is empty.
input A line contains three numbers c C B B A A 1 ≤ A , B , c ≤ 20 1≤A,B,C≤20
output All possible amounts of milk in a glass with capacity c C while the glass with capacity A A is empty. These values should be sorted in ascending order.
Example Sample entry 1 8 9 10 Plain text Sample output 1 1 2 8 9 10 Plain text Sample input 2 2 5 10 Plain text Sample output 2 5 6 7 8 9 10
- Assistant