Choose from an existing set of weights to make a target sum 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 -&gt; [2 0 0 0] - 2 plates of 1 kg plus the bar of 10 kg
13 -&gt; [0 0 0 0] - a special-case output that means "impossible"
20 -&gt; [0 0 2 0] - 2 plates of 5 kg + bar
20 -&gt; [0 4 0 0] - a different acceptable solution for the above
21 -&gt; [6 2 0 0] - 6 plates of 1 kg + 2 plates of 2.5 kg + bar
28 -&gt; [0 0 0 0] - impossible
45 -&gt; [0 2 6 0] - a solution for a random number in range
112 -&gt; [2 4 6 6] - a solution for a random number in range
121 -&gt; [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.
MATL, 29 28 bytes
4t:qEZ^!&quot;[l2.5AX]@Y*10+G=?@.

For inputs that have no solution this produces an empty output (without error).
Try it online!
Explanation
4           % Push 4
t:q         % Duplicate 4 and transform into range [0 1 2 3]
E           % Multiply by 2: transform into [0 2 4 6]
Z^          % Cartesian power. Each row is a &quot;combination&quot; of the four numbers
!           % Transpose
&quot;           % For each column
  [l2.5AX]  %   Push [1 2.5 5 10]
  @         %   Push current column
  Y*        %   Matrix multiply. Gives sum of products
  10+       %   Add 10
  G=        %   Compare with input: are they equal?
  ?         %   If so
    @       %     Push current column, to be displayed
    .       %     Break loop
            %   Implicit end
            % Implicit end
            % Implicit display