Weight calculation.