First, to simplify, instead of talking about an A and B and having 25% ownership after these rounds. Let's assume $10M is invested in the A for 25% ownership ($10M on a $30M pre-money valuation / $40M post-money.) Of course if each of these companies exits at exactly $50M and money just sits there for 10 years then the returns will be garbage. But in reality if you're investing at a post-money of $40M, very few of your companies will exit at $50M.
What actually matters here is what happens with money after exits. If money is returned to investors immediately, then what we want is to solve:
$100M * (1.12)^Y <= .25 * (exit price)
For example, if ONE company goes from $40M post and exits at $562M after 3 years, and then this money is distributed back to investors, then investors receive .25*$562 = $140.5M as a return, which is more than 12% per year for these three years ON THEIR ENTIRE $100M investment. (This assumed no subsequent dilution but you get the idea.)
If money isn't returned directly to investors then it needs to be re-invested. The point is, of course your venture returns will be poor if you just place your cash under a mattress post exits. The math becomes much more favorable for the VCs with realistic time assumptions.