A man travels from Town X to Town Y at an average rate of 50 mph and returns at an average rate of 40 mph. He takes a 1/2 hour longer than he would take if he made the round trip at an average of 45 mph. What is the distance from Town X to Town Y?