Fred had 26 baseball cards and gave 18 to Mary. He then finds an unopened box of 40. How many cards does he have in all?