Time limit
2s
Memory limit
128 MB
There are three water jugs with capacities A, B, and C liters, where 1 <= A, B, C <= 200. At first, the first and second jugs are empty, and the third jug is full with C liters of water.
You may pour water from one jug into another. When pouring, you must continue until the source jug becomes empty or the destination jug becomes full. No water is lost during this process.
After repeating this process any number of times, find every amount of water that can be in the third jug in a state where the first jug is empty.
The first line contains three integers A, B, and C separated by spaces.
Print all possible amounts of water in the third jug in ascending order, separated by spaces.