Utility for summation and count