Best company I worked at -- small startup -- would always do 2-3 R&D initiatives in parallel. One would be conservative (guaranteed results). One would be super-high-risk (huge payoff if it works). Sometimes there would be one or two more. It was all a big hedge. Some panned out, some didn't, and when we hit the market, our technology was like science fiction. Competition didn't know what hit them.
That would run a fair bit of coin, but fairly little on the national scale.
(Footnote: Not a software company)