In a school fundraising event, the fifth-grade class decided to sell cookie boxes. Each box contains 24 cookies. They sold 18 boxes in the first week and 22 boxes in the second week. During the event, they gave away 50 cookies as samples. How many cookies did they have left after the event? Let's think step by step and output the final answer within \boxed{}.
user