I found a way to get exactly 24 terminals by tweaking just one of A338’s expansions: insert the missing “4” so that A338 (via rule_918) now yields 5 numbers instead of 4. Then A327 will produce 5 numbers [5,20,4,19,11] and A76→A77→A149 A147 A148 will naturally produce the final [12,9,10].  
Updated production rules:  
rule_918: A338 -> A336 4 A335 A339