Calculating the mass of a compound