US spent just under $2T in Iraq and just over $2T in Afghanistan, for a total of just over $4T.
If you consider indirect costs I believe it ends up at $18T or more.