Hello, Alyssa,
Take each mass in the example formulation and convert it into a fraction by dividing the individual masses by the total of 8 grams. Then multiply these fractions (percentages) by 96 to obtain the correct apportionment among the three ingredients.
Bob