When doing weightlifting, I want to make a specific weight by attaching several plates to a bar. I have the following plates: * 6 plates of 1 kg each * 6 plates of 2.5 kg each * 6 plates of 5 kg each * 6 plates of 10 kg each The bar itself weighs 10 kg. It's only allowed to attach the plates in pairs - they are attached at each end of the bar, and the arrangement at the two ends must be completely symmetrical (e.g. attaching two 5-kg plates at one end, and one 10-kg plate at the other end is forbidden for reasons of safety). Make a program or a function that tells me how many plates of each kind I have to use in order to get a given total weight. The input is an integer greater than 11; the output is a list/array/string of 4 numbers. If it's impossible to combine existing plates to get the target weight, output a zero/empty array, an invalid string, throw an exception or some such. If there are several solutions, the code must output only one (don't make the user choose - he is too busy with other things). Test cases: 12 -> [2 0 0 0] - 2 plates of 1 kg plus the bar of 10 kg 13 -> [0 0 0 0] - a special-case output that means "impossible" 20 -> [0 0 2 0] - 2 plates of 5 kg + bar 20 -> [0 0 4 0] - a different acceptable solution for the above 21 -> [6 2 0 0] - 6 plates of 1 kg + 2 plates of 2.5 kg + bar 28 -> [0 0 0 0] - impossible 45 -> [0 2 6 0] - a solution for a random number in range 112 -> [2 4 6 6] - a solution for a random number in range 121 -> [6 6 6 6] - maximal weight for which a solution is possible If your code outputs the numbers in the opposite order (from the heavy plate to the light one), please specify this explicitly to avoid confusion.