Simplify repeat_sum