Calculating mass through work and energy