Integrating sums of functions