A car travels from City X to City Y and back. The distance between City X and City Y is 300 kilometers. On the way to City Y, the car travels at an average speed of 60 kilometers per hour. On the way back to City X, due to traffic, the car travels at an average speed of 40 kilometers per hour. How long does the entire trip take? Let's think step by step and output the final answer within \boxed{}.
user