memoizing running totals function@