Splits total over weights in proportion, by the largest-remainder method: each share is floored, then the units left over go to the largest remainders, the earlier index first on a tie. The shares sum to exactly total and none is negative.