A factory hires two teams of workers to complete a large order. Team X consists of 15 workers, and Team Y consists of 10 workers. Each worker in Team X can produce 12 units per day, while each worker in Team Y can produce 18 units per day. After working together for 5 days, Team X leaves and Team Y continues working for another 3 days to complete the order. If the total order consists of 3,240 units, how many units did each team produce? Let's think step by step and output the final answer within \boxed{}.
user