40 billion is an insignifiant amount for a rich country like thr US and the scientific knowledge that was gained from it and is still going on today is immesurable.
Personnaly I think it was way worth it and we should keep going to further science and knowledge.
Totally worth it imo.