John has 5 packs of pencils, and each pack contains 12 pencils. He gives 18 pencils to his friend, and then buys 3 more packs of pencils, each containing 10 pencils. How many pencils does John have now? Let's think step by step and output the final answer within \boxed{}.
user