add moving sum to output