WeightedSum mapping function.