The above problem is similar to the knapsack problem with following parameters:-
knapsack capacity = length = 900
items weights : 321 (900/321=2 times), 215 (900/215=4 times), 111(900/111=8 times).....
values = weights
maximize profit & store min needed abscissas of each subproblem
if max profit == knapsack capacity
solution exists retrace solution with minimum abscissas
else doesnt exist.
There is DP solution for Knapsack in pseudo polynomial time