Fixed calculation for large numbers of groups