Three functions to compute a sum