Write a function to find optimal selection of packages from amazon warehouse. Packages contain varying units of a product for eg: one can have 5 units of iphones another can have 3 and so on. Each package is present infinitely ie. take one then there are still infinite left. You can break into a package, you have to take it as a whole. Also, smaller size packages should be used first. Lot of modifications.