Calculation of mass in chemical reactions