Ashley and Beth drove from city A to city B in exactly 5 hours, not taking rest stops. Ashley drove up to the area located halfway between the two cities at the average speed of 40 miles per hour and then Beth drove the other half at an average speed of 60 miles per hour. How many hours did Beth drive on their trip?