Martin traveled at an average rate of 40 miles per hour for the first half of his trip. For the second half of his trip, he traveled at a rate of 60 miles per hour. How far did he travel in the 4-hour trip?