Bill drove to the mountains last weekend. There was heavy traffic on the way there, and the trip took 9 hours. When Bill drove home, there was no traffic and the trip only took 4 hours. If his average rate was 40 miles per hour faster on the trip home, how far away does Bill live from the mountains?