Refactor 'sum root to leaf numbers'.