Add iterative sum function.