sums per groups in distribution