Welcome to the forum.
I am not aware of a neat mathematical formula. You could try dynamic programming: for each intermediate amount 0 <= A <= 1360 in turn you find and store the sets of items you can buy with A, and you find the corresponding sets for A + 1 by subtracting the price of each item from A + 1 and looking up the corresponding distributions. For example, if you generated the distributions for all A <= 1000, you consider distributions for 1001 - 975 and add the first item to them, distributions for 1001 - 520 and add the second item to them, etc. It makes sense to divide the numbers by the greatest common divisor first. Alternatively, you could consider all possible multisets of items up to certain cardinality and eliminate those that go over the total amount or allow adding another item.
Both methods above take exponential time, but it is possible that there is no way around it, at least when all numbers are integers. If you generate all distributions, then you can also find the distributions with the highest amount under the given limit. Finding such highest amount is known as an unbounded knapsack problem where values equal weights .